mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 17:14:44 +01:00
Use rclone.conf from rclone executable directory if already existing
This commit is contained in:
parent
550ab441c5
commit
976a020a2f
@ -452,7 +452,11 @@ Specify the location of the rclone config file.
|
||||
Normally the config file is in your home directory as a file called
|
||||
`.config/rclone/rclone.conf` (or `.rclone.conf` if created with an
|
||||
older version). If `$XDG_CONFIG_HOME` is set it will be at
|
||||
`$XDG_CONFIG_HOME/rclone/rclone.conf`
|
||||
`$XDG_CONFIG_HOME/rclone/rclone.conf`.
|
||||
|
||||
If there is a file `rclone.conf` in the same directory as the rclone
|
||||
executable it will be preferred. This file must be created manually
|
||||
for Rclone to use it, it will never be created automatically.
|
||||
|
||||
If you run `rclone config file` you will see where the default
|
||||
location is for you.
|
||||
|
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user