Support XDG_CONFIG_HOME/XDG_DATA_HOME on Windows (#2119)

This commit is contained in:
Joe Lim authored and GitHub committed 2025-08-26 22:55:45 +10:00
1 parent 4fe8f5a858
commit ae583e96d3
4 files changed
+16 -2

No files matched your search

+2
View File
@@ -366,9 +366,11 @@ You can configure these locations with the following variables given with their
Windows
%LF_CONFIG_HOME%
%XDG_CONFIG_HOME%
%APPDATA%
%LF_DATA_HOME%
%XDG_DATA_HOME%
%LOCALAPPDATA%
A sample configuration file can be found at
+2
View File
@@ -359,9 +359,11 @@ with their order of precedences and their default values:
Windows
%LF_CONFIG_HOME%
%XDG_CONFIG_HOME%
%APPDATA%
%LF_DATA_HOME%
%XDG_DATA_HOME%
%LOCALAPPDATA%
A sample configuration file can be found at
+2
View File
@@ -398,9 +398,11 @@ Unix
Windows
%LF_CONFIG_HOME%
%XDG_CONFIG_HOME%
%APPDATA%
%LF_DATA_HOME%
%XDG_DATA_HOME%
%LOCALAPPDATA%
.EE
.PP
+10 -2
View File
@@ -74,7 +74,11 @@ func init() {
Username: username,
}
config := cmp.Or(os.Getenv("LF_CONFIG_HOME"), os.Getenv("APPDATA"))
config := cmp.Or(
os.Getenv("LF_CONFIG_HOME"),
os.Getenv("XDG_CONFIG_HOME"),
os.Getenv("APPDATA"),
)
gConfigPaths = []string{
filepath.Join(os.Getenv("ProgramData"), "lf", "lfrc"),
@@ -91,7 +95,11 @@ func init() {
filepath.Join(config, "lf", "icons"),
}
data := cmp.Or(os.Getenv("LF_DATA_HOME"), os.Getenv("LOCALAPPDATA"))
data := cmp.Or(
os.Getenv("LF_DATA_HOME"),
os.Getenv("XDG_DATA_HOME"),
os.Getenv("LOCALAPPDATA"),
)
gFilesPath = filepath.Join(data, "lf", "files")
gMarksPath = filepath.Join(data, "lf", "marks")