add support for LF_CONFIG/DATA_HOME on unix

cc #1209 #1253
This commit is contained in:
Gokcehan committed 2023-07-03 14:14:56 +03:00
1 parent bc0bc6e3be
commit 067ffa8f1a
4 files changed
+55 -21

No files matched your search

+14 -6
View File
@@ -288,16 +288,24 @@ History file should be located at:
Unix ~/.local/share/lf/history
Windows C:\Users\<user>\AppData\Local\lf\history
You can configure the default values of following variables to change these locations:
You can configure these locations with the following variables given with their order of precedences and their default values:
Unix
$XDG_CONFIG_HOME ~/.config
$XDG_DATA_HOME ~/.local/share
$LF_CONFIG_HOME
$XDG_CONFIG_HOME
~/.config
$LF_DATA_HOME
$XDG_DATA_HOME
~/.local/share
Windows
%ProgramData% C:\ProgramData
%LOCALAPPDATA% C:\Users\<user>\AppData\Local
%LF_CONFIG_HOME% If set, use this value instead of %LOCALAPPDATA%
%ProgramData%
C:\ProgramData
%LF_CONFIG_HOME%
%LOCALAPPDATA%
C:\Users\<user>\AppData\Local
A sample configuration file can be found at
https://github.com/gokcehan/lf/blob/master/etc/lfrc.example
+15 -7
View File
@@ -293,17 +293,25 @@ History file should be located at:
Unix ~/.local/share/lf/history
Windows C:\Users\<user>\AppData\Local\lf\history
You can configure the default values of following variables to change these
locations:
You can configure these locations with the following variables given with their
order of precedences and their default values:
Unix
$XDG_CONFIG_HOME ~/.config
$XDG_DATA_HOME ~/.local/share
$LF_CONFIG_HOME
$XDG_CONFIG_HOME
~/.config
$LF_DATA_HOME
$XDG_DATA_HOME
~/.local/share
Windows
%ProgramData% C:\ProgramData
%LOCALAPPDATA% C:\Users\<user>\AppData\Local
%LF_CONFIG_HOME% If set, use this value instead of %LOCALAPPDATA%
%ProgramData%
C:\ProgramData
%LF_CONFIG_HOME%
%LOCALAPPDATA%
C:\Users\<user>\AppData\Local
A sample configuration file can be found at
https://github.com/gokcehan/lf/blob/master/etc/lfrc.example
+18 -6
View File
@@ -334,19 +334,31 @@ History file should be located at:
Windows C:\eUsers\e<user>\eAppData\eLocal\elf\ehistory
.EE
.PP
You can configure the default values of following variables to change these locations:
You can configure these locations with the following variables given with their order of precedences and their default values:
.PP
.EX
Unix
$XDG_CONFIG_HOME ~/.config
$XDG_DATA_HOME ~/.local/share
$LF_CONFIG_HOME
$XDG_CONFIG_HOME
~/.config
.EE
.PP
.EX
$LF_DATA_HOME
$XDG_DATA_HOME
~/.local/share
.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%
%ProgramData%
C:\eProgramData
.EE
.PP
.EX
%LF_CONFIG_HOME%
%LOCALAPPDATA%
C:\eUsers\e<user>\eAppData\eLocal
.EE
.PP
A sample configuration file can be found at https://github.com/gokcehan/lf/blob/master/etc/lfrc.example
+8 -2
View File
@@ -84,7 +84,10 @@ func init() {
}
gUser = u
config := os.Getenv("XDG_CONFIG_HOME")
config := os.Getenv("LF_CONFIG_HOME")
if config == "" {
config = os.Getenv("XDG_CONFIG_HOME")
}
if config == "" {
config = filepath.Join(gUser.HomeDir, ".config")
}
@@ -104,7 +107,10 @@ func init() {
filepath.Join(config, "lf", "icons"),
}
data := os.Getenv("XDG_DATA_HOME")
data := os.Getenv("LF_DATA_HOME")
if data == "" {
data = os.Getenv("XDG_DATA_HOME")
}
if data == "" {
data = filepath.Join(gUser.HomeDir, ".local", "share")
}