Use rclone.conf from rclone executable directory if already existing

This commit is contained in:
albertony
2019-06-12 10:08:00 +01:00
committed by Nick Craig-Wood
parent 550ab441c5
commit 976a020a2f
2 changed files with 17 additions and 1 deletions
+12
View File
@@ -105,6 +105,18 @@ func getConfigData() *goconfig.ConfigFile {
// Return the path to the configuration file
func makeConfigPath() string {
// Use rclone.conf from rclone executable directory if already existing
exe, err := os.Executable()
if err == nil {
exedir := filepath.Dir(exe)
cfgpath := filepath.Join(exedir, configFileName)
_, err := os.Stat(cfgpath)
if err == nil {
return cfgpath
}
}
// Find user's home directory
homeDir, err := homedir.Dir()