diff options
| -rw-r--r-- | steam-export-cli.go | 21 | ||||
| -rw-r--r-- | steam/unix.go | 10 | ||||
| -rw-r--r-- | steam/windows.go | 3 |
3 files changed, 23 insertions, 11 deletions
diff --git a/steam-export-cli.go b/steam-export-cli.go index 5f5a0ca..e738fa9 100644 --- a/steam-export-cli.go +++ b/steam-export-cli.go @@ -13,8 +13,7 @@ import ( var ( errorHandling flag.ErrorHandling = flag.ExitOnError - defaultLib string = `C:\Program Files (x86)\Steam\steamapps` - steamLib *steam.Library = &steam.Library{} + steamLib *steam.Library = &steam.Library{} ) func parseArgs(args []string) error { @@ -54,10 +53,10 @@ Subcommands: func listGames(args []string) error { fl := flag.NewFlagSet("list", errorHandling) - lib := fl.String("l", defaultLib, + lib := fl.String("l", steam.DefaultLib, "Path to library in question. All the way to the 'steamapps' folder") - l := defaultLib + l := steam.DefaultLib fl.Parse(args) if fl.Parsed() { l = string(*lib) @@ -74,7 +73,7 @@ func listGames(args []string) error { func packageGame(args []string) error { fl := flag.NewFlagSet("package", errorHandling) - lib := fl.String("l", defaultLib, + lib := fl.String("l", steam.DefaultLib, "Path to library in question. All the way to the 'steamapps' folder") fileName := fl.String("f", "export", "Name of the archive file to be created. Please do not include the file extension") @@ -82,7 +81,7 @@ func packageGame(args []string) error { "Index of the game to be exported. Please see `list` for the index") var g int - l := defaultLib + l := steam.DefaultLib fl.Parse(args) if fl.Parsed() { l = string(*lib) @@ -107,12 +106,12 @@ func packageGame(args []string) error { func extractGame(args []string) error { fl := flag.NewFlagSet("extract", errorHandling) - lib := fl.String("l", defaultLib, + lib := fl.String("l", steam.DefaultLib, "Path to library in question. All the way to the 'steamapps' folder") fileName := fl.String("f", "", "Name of the archive file to be extracted. Please include the file extension") - l := defaultLib + l := steam.DefaultLib fl.Parse(args) if fl.Parsed() { l = string(*lib) @@ -132,13 +131,13 @@ func extractGame(args []string) error { func deleteGame(args []string) error { fl := flag.NewFlagSet("delete", errorHandling) - lib := fl.String("l", defaultLib, + lib := fl.String("l", steam.DefaultLib, "Path to library in question. All the way to the 'steamapps' folder") game := fl.Int("g", -1, "Index of the game to be deleted. Please see `list` for the index") var g int - l := defaultLib + l := steam.DefaultLib fl.Parse(args) if fl.Parsed() { l = string(*lib) @@ -162,7 +161,7 @@ func main() { fmt.Println(err) } else { if config.DefaultRepository != "" { - defaultLib = config.DefaultRepository + steam.DefaultLib = config.DefaultRepository } } diff --git a/steam/unix.go b/steam/unix.go new file mode 100644 index 0000000..caa4b43 --- /dev/null +++ b/steam/unix.go @@ -0,0 +1,10 @@ +// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris + +package steam + +import ( + "os" + "path/filepath" +) + +var DefaultLib string = filepath.Join(os.Getenv("HOME"), ".steam/steam/steamapps") diff --git a/steam/windows.go b/steam/windows.go new file mode 100644 index 0000000..215d1d7 --- /dev/null +++ b/steam/windows.go @@ -0,0 +1,3 @@ +package steam + +var DefaultLib string = `C:\Program Files (x86)\Steam\steamapps` |
