Skip to content

Commit bba01c7

Browse files
committed
Add XDG support for rdbgrc file (#1031)
This commit implements XDG directory support for this gem's `.rdbgrc` configuration file in accordance with the rules outlined in #1031: > 1. prefer `~/.rdbgrc` if present, > 2. else, `$XDG_CONFIG_HOME/rdbg/config` if `$XDG_CONFIG_HOME` is set > and `$XDG_CONFIG_HOME/rdbg/config` is present, > 3. else, no customized user configuration See: #1031 (comment)
1 parent d8ef53d commit bba01c7

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

lib/debug/session.rb

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2293,11 +2293,19 @@ def skip?
22932293
end
22942294

22952295
def self.load_rc
2296-
[[File.expand_path('~/.rdbgrc'), true],
2297-
[File.expand_path('~/.rdbgrc.rb'), true],
2298-
# ['./.rdbgrc', true], # disable because of security concern
2299-
[CONFIG[:init_script], false],
2300-
].each{|(path, rc)|
2296+
rc_file_paths = [
2297+
[File.expand_path('~/.rdbgrc'), true],
2298+
[File.expand_path('~/.rdbgrc.rb'), true],
2299+
# ['./.rdbgrc', true], # disable because of security concern
2300+
]
2301+
2302+
if (xdg_home = ENV["XDG_CONFIG_HOME"])
2303+
rc_file_paths << [File.expand_path(File.join(xdg_home, "rdbg", "config")), true]
2304+
end
2305+
2306+
rc_file_paths << [CONFIG[:init_script], false]
2307+
2308+
rc_file_paths.each{|(path, rc)|
23012309
next unless path
23022310
next if rc && CONFIG[:no_rc] # ignore rc
23032311

0 commit comments

Comments
 (0)