Fixed extract command (and changed it to --extract).

This commit is contained in:
Sander Schobers 2021-08-10 19:41:30 +02:00
parent f9da21b61c
commit 165d1fcd26
3 changed files with 4 additions and 4 deletions

View File

@ -132,7 +132,7 @@ go install -tags static,allegro -ldflags "-s -w" opslag.de/schobers/tins2021/cmd
In this case the SDL 2.0 prerequisite is replaced by the Allegro 5.2 (development libraries must be available for your C compiler).
## Command line interface
You can extract all resources embedded in the executable by running it from the command line with the `--extract-resources` flag. The resources will be extract in the current working directory. Note that the game will use the resources on disk first if they are available.
You can extract all resources embedded in the executable by running it from the command line with the `--extract` flag. The resources will be extract in the current working directory. Note that the game will use the resources on disk first if they are available.
## Sources
Can be found at https://opslag.de/schobers/tins2021 (Git repository).

View File

@ -21,7 +21,7 @@ func copyFile(path string, file fs.File) error {
}
func copyBoxToDisk(resources embed.FS) error {
return fs.WalkDir(resources, "", func(path string, entry fs.DirEntry, err error) error {
return fs.WalkDir(resources, ".", func(path string, entry fs.DirEntry, err error) error {
if err != nil {
return err
}
@ -33,6 +33,6 @@ func copyBoxToDisk(resources embed.FS) error {
return err
}
defer src.Close()
return copyFile(filepath.Join(`resources`, path), src)
return copyFile(path, src)
})
}

View File

@ -30,7 +30,7 @@ func openResources() ui.Resources {
func run() error {
var extract bool
flag.BoolVar(&extract, "extract-resources", false, "extracts all resources to the current working directory")
flag.BoolVar(&extract, "extract", false, "extracts all resources to the current working directory")
flag.Parse()
if extract {