backends: make sure backends expand ~ and environment vars in file names they use

See: https://forum.rclone.org/t/relative-path-in-rclone-config-service-account-json/16693
This commit is contained in:
Nick Craig-Wood 2020-06-02 11:54:52 +01:00
parent b62d08d136
commit 973e3d6a7b
5 changed files with 13 additions and 8 deletions

3
lib/env/env.go vendored
View file

@ -7,6 +7,9 @@ import (
homedir "github.com/mitchellh/go-homedir"
)
// ShellExpandHelp describes what ShellExpand does for inclusion into help
const ShellExpandHelp = "\n\nLeading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.\n"
// ShellExpand replaces a leading "~" with the home directory" and
// expands all environment variables afterwards.
func ShellExpand(s string) string {