mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[ruby/optparse] Use ~/.config
only if $XDG_CONFIG_HOME
is unset or empty
2f9c7500a3
This commit is contained in:
parent
3ad26d0501
commit
f76ce9fd28
2 changed files with 21 additions and 5 deletions
|
@ -2049,10 +2049,16 @@ XXX
|
|||
basename = File.basename($0, '.*')
|
||||
return true if load(File.expand_path("~/.options/#{basename}"), **keywords) rescue nil
|
||||
basename << ".options"
|
||||
if !(xdg = ENV['XDG_CONFIG_HOME']) or xdg.empty?
|
||||
# https://specifications.freedesktop.org/basedir-spec/latest/#variables
|
||||
#
|
||||
# If $XDG_CONFIG_HOME is either not set or empty, a default
|
||||
# equal to $HOME/.config should be used.
|
||||
xdg = ['~/.config', true]
|
||||
end
|
||||
return [
|
||||
# XDG
|
||||
ENV['XDG_CONFIG_HOME'],
|
||||
['~/.config', true],
|
||||
xdg,
|
||||
|
||||
*ENV['XDG_CONFIG_DIRS']&.split(File::PATH_SEPARATOR),
|
||||
|
||||
# Haiku
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue