LF_CONFIG_HOME environment variable (#1253)

* Added LF_CONFIG_HOME environment variable

* Added and generated documentation for LF_CONFIG_HOME
This commit is contained in:
Alok Mishra authored and GitHub committed 2023-05-21 01:53:55 +03:00
1 parent 3b942a8a39
commit 8fee7f0927
4 files changed
+30 -13

No files matched your search

+8 -4
View File
@@ -283,10 +283,14 @@ History file should be located at:
You can configure the default values of following variables to change these locations: You can configure the default values of following variables to change these locations:
$XDG_CONFIG_HOME ~/.config Unix
$XDG_DATA_HOME ~/.local/share $XDG_CONFIG_HOME ~/.config
%ProgramData% C:\ProgramData $XDG_DATA_HOME ~/.local/share
%LOCALAPPDATA% C:\Users\<user>\AppData\Local
Windows
%ProgramData% C:\ProgramData
%LOCALAPPDATA% C:\Users\<user>\AppData\Local
%LF_CONFIG_HOME% If set, use this value instead of %LOCALAPPDATA%
A sample configuration file can be found at A sample configuration file can be found at
https://github.com/gokcehan/lf/blob/master/etc/lfrc.example https://github.com/gokcehan/lf/blob/master/etc/lfrc.example
+8 -4
View File
@@ -289,10 +289,14 @@ History file should be located at:
You can configure the default values of following variables to change these You can configure the default values of following variables to change these
locations: locations:
$XDG_CONFIG_HOME ~/.config Unix
$XDG_DATA_HOME ~/.local/share $XDG_CONFIG_HOME ~/.config
%ProgramData% C:\ProgramData $XDG_DATA_HOME ~/.local/share
%LOCALAPPDATA% C:\Users\<user>\AppData\Local
Windows
%ProgramData% C:\ProgramData
%LOCALAPPDATA% C:\Users\<user>\AppData\Local
%LF_CONFIG_HOME% If set, use this value instead of %LOCALAPPDATA%
A sample configuration file can be found at A sample configuration file can be found at
https://github.com/gokcehan/lf/blob/master/etc/lfrc.example https://github.com/gokcehan/lf/blob/master/etc/lfrc.example
+10 -4
View File
@@ -330,10 +330,16 @@ History file should be located at:
You can configure the default values of following variables to change these locations: You can configure the default values of following variables to change these locations:
.PP .PP
.EX .EX
$XDG_CONFIG_HOME ~/.config Unix
$XDG_DATA_HOME ~/.local/share $XDG_CONFIG_HOME ~/.config
%ProgramData% C:\eProgramData $XDG_DATA_HOME ~/.local/share
%LOCALAPPDATA% C:\eUsers\e<user>\eAppData\eLocal .EE
.PP
.EX
Windows
%ProgramData% C:\eProgramData
%LOCALAPPDATA% C:\eUsers\e<user>\eAppData\eLocal
%LF_CONFIG_HOME% If set, use this value instead of %LOCALAPPDATA%
.EE .EE
.PP .PP
A sample configuration file can be found at https://github.com/gokcehan/lf/blob/master/etc/lfrc.example A sample configuration file can be found at https://github.com/gokcehan/lf/blob/master/etc/lfrc.example
+4 -1
View File
@@ -68,7 +68,10 @@ func init() {
// remove domain prefix // remove domain prefix
gUser.Username = strings.Split(gUser.Username, `\`)[1] 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{ gConfigPaths = []string{
filepath.Join(os.Getenv("ProgramData"), "lf", "lfrc"), filepath.Join(os.Getenv("ProgramData"), "lf", "lfrc"),