use XDG_RUNTIME_DIR for the socket file

cc #722 #726
This commit is contained in:
Gokcehan committed 2022-02-06 23:45:40 +03:00
1 parent 1703dcc11f
commit 86e84c9151
4 files changed
+9 -4

No files matched your search

+6 -1
View File
@@ -88,7 +88,12 @@ func init() {
gMarksPath = filepath.Join(data, "lf", "marks")
gHistoryPath = filepath.Join(data, "lf", "history")
gDefaultSocketPath = filepath.Join(os.TempDir(), fmt.Sprintf("lf.%s.sock", gUser.Username))
runtime := os.Getenv("XDG_RUNTIME_DIR")
if runtime == "" {
runtime = os.TempDir()
}
gDefaultSocketPath = filepath.Join(runtime, fmt.Sprintf("lf.%s.sock", gUser.Username))
}
func detachedCommand(name string, arg ...string) *exec.Cmd {