diff --git a/doc.go b/doc.go index ad63b495..da4cc26b 100644 --- a/doc.go +++ b/doc.go @@ -283,10 +283,14 @@ History file should be located at: You can configure the default values of following variables to change these locations: - $XDG_CONFIG_HOME ~/.config - $XDG_DATA_HOME ~/.local/share - %ProgramData% C:\ProgramData - %LOCALAPPDATA% C:\Users\\AppData\Local + Unix + $XDG_CONFIG_HOME ~/.config + $XDG_DATA_HOME ~/.local/share + + Windows + %ProgramData% C:\ProgramData + %LOCALAPPDATA% C:\Users\\AppData\Local + %LF_CONFIG_HOME% If set, use this value instead of %LOCALAPPDATA% A sample configuration file can be found at https://github.com/gokcehan/lf/blob/master/etc/lfrc.example diff --git a/docstring.go b/docstring.go index b5b659e1..e8e198bd 100644 --- a/docstring.go +++ b/docstring.go @@ -289,10 +289,14 @@ History file should be located at: You can configure the default values of following variables to change these locations: - $XDG_CONFIG_HOME ~/.config - $XDG_DATA_HOME ~/.local/share - %ProgramData% C:\ProgramData - %LOCALAPPDATA% C:\Users\\AppData\Local + Unix + $XDG_CONFIG_HOME ~/.config + $XDG_DATA_HOME ~/.local/share + + Windows + %ProgramData% C:\ProgramData + %LOCALAPPDATA% C:\Users\\AppData\Local + %LF_CONFIG_HOME% If set, use this value instead of %LOCALAPPDATA% A sample configuration file can be found at https://github.com/gokcehan/lf/blob/master/etc/lfrc.example diff --git a/lf.1 b/lf.1 index a2f0eca0..848d49a5 100644 --- a/lf.1 +++ b/lf.1 @@ -330,10 +330,16 @@ History file should be located at: You can configure the default values of following variables to change these locations: .PP .EX - $XDG_CONFIG_HOME ~/.config - $XDG_DATA_HOME ~/.local/share - %ProgramData% C:\eProgramData - %LOCALAPPDATA% C:\eUsers\e\eAppData\eLocal + Unix + $XDG_CONFIG_HOME ~/.config + $XDG_DATA_HOME ~/.local/share +.EE +.PP +.EX + Windows + %ProgramData% C:\eProgramData + %LOCALAPPDATA% C:\eUsers\e\eAppData\eLocal + %LF_CONFIG_HOME% If set, use this value instead of %LOCALAPPDATA% .EE .PP A sample configuration file can be found at https://github.com/gokcehan/lf/blob/master/etc/lfrc.example diff --git a/os_windows.go b/os_windows.go index 2dca3376..b79d99e5 100644 --- a/os_windows.go +++ b/os_windows.go @@ -68,7 +68,10 @@ func init() { // remove domain prefix gUser.Username = strings.Split(gUser.Username, `\`)[1] - data := os.Getenv("LOCALAPPDATA") + data := os.Getenv("LF_CONFIG_HOME") + if data == "" { + data = os.Getenv("LOCALAPPDATA") + } gConfigPaths = []string{ filepath.Join(os.Getenv("ProgramData"), "lf", "lfrc"),