Fix file errors in utilities.
parent
c3d53d04e1
commit
297d5a52a9
|
@ -13,7 +13,7 @@ var (
|
||||||
|
|
||||||
argOld = cli.Arg("old", "The old file.").Required().ExistingFile()
|
argOld = cli.Arg("old", "The old file.").Required().ExistingFile()
|
||||||
argNew = cli.Arg("new", "The new file.").Required().ExistingFile()
|
argNew = cli.Arg("new", "The new file.").Required().ExistingFile()
|
||||||
argPatch = cli.Arg("patch", "Where to output the patch file.").Required().File()
|
argPatch = cli.Arg("patch", "Where to output the patch file.").Required().String()
|
||||||
)
|
)
|
||||||
|
|
||||||
func must(err error) {
|
func must(err error) {
|
||||||
|
@ -27,7 +27,8 @@ func must(err error) {
|
||||||
func main() {
|
func main() {
|
||||||
kingpin.MustParse(cli.Parse(os.Args[1:]))
|
kingpin.MustParse(cli.Parse(os.Args[1:]))
|
||||||
|
|
||||||
patchFile := *argPatch
|
patchFile, err := os.Create(*argPatch)
|
||||||
|
must(err)
|
||||||
defer patchFile.Close()
|
defer patchFile.Close()
|
||||||
|
|
||||||
oldFile, err := os.Open(*argOld)
|
oldFile, err := os.Open(*argOld)
|
||||||
|
|
|
@ -12,7 +12,7 @@ var (
|
||||||
cli = kingpin.New("go-bspatch", "Applies binary patches generated using the bsdiff algorithm.")
|
cli = kingpin.New("go-bspatch", "Applies binary patches generated using the bsdiff algorithm.")
|
||||||
|
|
||||||
argOld = cli.Arg("old", "The old file.").Required().ExistingFile()
|
argOld = cli.Arg("old", "The old file.").Required().ExistingFile()
|
||||||
argNew = cli.Arg("new", "Where the new file will be written to.").Required().File()
|
argNew = cli.Arg("new", "Where the new file will be written to.").Required().String()
|
||||||
argPatch = cli.Arg("patch", "The patch file.").Required().ExistingFile()
|
argPatch = cli.Arg("patch", "The patch file.").Required().ExistingFile()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -27,13 +27,14 @@ func must(err error) {
|
||||||
func main() {
|
func main() {
|
||||||
kingpin.MustParse(cli.Parse(os.Args[1:]))
|
kingpin.MustParse(cli.Parse(os.Args[1:]))
|
||||||
|
|
||||||
newFile := *argNew
|
|
||||||
defer newFile.Close()
|
|
||||||
|
|
||||||
oldFile, err := os.Open(*argOld)
|
oldFile, err := os.Open(*argOld)
|
||||||
must(err)
|
must(err)
|
||||||
defer oldFile.Close()
|
defer oldFile.Close()
|
||||||
|
|
||||||
|
newFile, err := os.Create(*argNew)
|
||||||
|
must(err)
|
||||||
|
defer newFile.Close()
|
||||||
|
|
||||||
patchFile, err := os.Open(*argPatch)
|
patchFile, err := os.Open(*argPatch)
|
||||||
must(err)
|
must(err)
|
||||||
defer patchFile.Close()
|
defer patchFile.Close()
|
||||||
|
|
Loading…
Reference in New Issue