aboutsummaryrefslogtreecommitdiff
path: root/config/config.go
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2020-11-20 22:48:46 -0500
committerMitch Riedstra <mitch@riedstra.us>2020-11-20 22:48:46 -0500
commit78712527eed66929b8147e04d18f000dcb7dfff6 (patch)
tree612e0a4110072eab973dfa930ba04de59c06020a /config/config.go
parent891447f0e40a6d1a9637b3333cffed8eb2543c51 (diff)
downloadsteam-export-78712527eed66929b8147e04d18f000dcb7dfff6.tar.gz
steam-export-78712527eed66929b8147e04d18f000dcb7dfff6.tar.xz
Remove dead code. Remove 32 bit windows builds.
Diffstat (limited to 'config/config.go')
-rw-r--r--config/config.go89
1 files changed, 0 insertions, 89 deletions
diff --git a/config/config.go b/config/config.go
deleted file mode 100644
index 839acbf..0000000
--- a/config/config.go
+++ /dev/null
@@ -1,89 +0,0 @@
-// Used to define and load this application's specific configuration
-package config
-
-import (
- "gopkg.in/yaml.v2"
- "io/ioutil"
- "os"
- "os/exec"
-)
-
-type Config struct {
- SteamRepositories []string `yaml:"SteamRepositories"`
- DefaultRepository string `yaml:"DefaultRepository"`
- Listen string
-}
-
-var configFilename string = "steam-export.yml"
-
-// By default it reads 'config.yml' in the current directory
-func LoadConfig() (*Config, error) {
- c := &Config{}
- err := c.ReadDefaultConfig()
- return c, err
-}
-
-func (c *Config) ReadConfig(cfg string) error {
- contents, err := ioutil.ReadFile(cfg)
- if err != nil {
- return err
- }
- return yaml.Unmarshal([]byte(contents), c)
-}
-
-func checkConfigFile(cf string) error {
- // Check if our config file exists, or create it
- if _, err := os.Stat(cf); err != nil {
- if f, err := os.Create(cf); err != nil {
- return err
- } else {
- f.WriteString(`
----
-listen: 0.0.0.0:9413
-# Repositories that you want to expose on the web server
-SteamRepositories:
- # We're ideally looking for the full path to the steamapps folder
- # On windows you're going to escape the slashes
- - "C:\\Program Files (x86)\\Steam\\steamapps"
- # - "/usr/mitch/SteamGames/steamapps"
-
-# This defaults to:
-# Only change this if your default Steam library is different than the Steam default
-# DefaultRepository: "/usr/mitch/SteamGames/steamapps"
-# DefaultRepository: "Z:\\SteamGames\\steamapps"
-`)
- f.Close()
- }
- }
- return nil
-}
-
-func (c *Config) ReadDefaultConfig() error {
- if err := c.ReadConfig(configFilename); err != nil {
- if err = checkConfigFile(fn); err != nil {
- return err
- }
- return c.ReadConfig(fn)
- }
- return nil
-}
-
-func EditDefaultConfig(e string) error {
- if e != "" {
- editor = e
- }
-
- if _, err := os.Stat(configFilename); err != nil {
- if _, err := os.Stat(fn); err != nil {
- return err
- }
- c := exec.Command(editor, fn)
- c.Stdout = os.Stdout
- c.Stdin = os.Stdin
- c.Stderr = os.Stderr
- return c.Run()
- }
- cmd := exec.Command(editor, configFilename)
- return cmd.Run()
-
-}