Skip to content

Commit 258c2f0

Browse files
committed
Respect the HOME environment variable for session storage, where set.
1 parent 6062f50 commit 258c2f0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/proc/gdbserial/undo.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,17 @@ func getSessionPath(conn *gdbConn) (string, error) {
196196
panic("unexpected response from get_recording_ids")
197197
}
198198

199+
// This directory is used to determine where the sessions are stored, unless XDG_DATA_HOME
200+
// is set.
201+
home_dir, present := os.LookupEnv("HOME")
202+
if !present {
203+
home_dir = user.HomeDir
204+
}
205+
199206
// This directory stores sessions.
200207
xdg_data_dir, present := os.LookupEnv("XDG_DATA_HOME")
201208
if !present {
202-
xdg_data_dir = filepath.Join(user.HomeDir, ".local", "share")
209+
xdg_data_dir = filepath.Join(home_dir, ".local", "share")
203210
}
204211
undo_sessions_dir := filepath.Join(xdg_data_dir, "undo", "sessions")
205212

0 commit comments

Comments
 (0)