diff --git a/app.go b/app.go index 69b9f787..97f5f23e 100644 --- a/app.go +++ b/app.go @@ -174,9 +174,17 @@ func (app *app) loop() { }() } - for _, path := range gConfigPaths { - if _, err := os.Stat(path); !os.IsNotExist(err) { - app.readFile(path) + if gCustomConfig != "" { + if _, err := os.Stat(gCustomConfig); !os.IsNotExist(err) { + app.readFile(gCustomConfig) + } else { + log.Printf("Config file does not exist: %s", err) + } + } else { + for _, path := range gConfigPaths { + if _, err := os.Stat(path); !os.IsNotExist(err) { + app.readFile(path) + } } } diff --git a/main.go b/main.go index 5b191002..5820c55f 100644 --- a/main.go +++ b/main.go @@ -31,6 +31,7 @@ var ( gLogPath string gServerLogPath string gSelect string + gCustomConfig string gCommands arrayFlag gVersion string ) @@ -217,6 +218,11 @@ func main() { "", "path to the file to write selected files on open (to use as open file dialog)") + flag.StringVar(&gCustomConfig, + "config", + "", + "path to a custom config file to be used, instead of normal lfrc file") + flag.Var(&gCommands, "command", "command to execute on client initialization")