Skip to content
Permalink
Browse files

Find configuration file in XDG Base Directory

Find configuration file in XDG Base Directory only if `PRYRC` is not
set, and `~/.pryrc` does not exist, therefore not confusing current
users. Note that cache file path is not modified.
  • Loading branch information...
FranklinYu committed May 16, 2017
1 parent baa2904 commit a0be0cc7b2070edff61c0c7f10fa37fce9b730bd
Showing with 12 additions and 1 deletion.
  1. +12 −1 lib/pry/pry_class.rb
@@ -1,7 +1,18 @@
require 'pry/config'
class Pry

HOME_RC_FILE = ENV["PRYRC"] || "~/.pryrc"
HOME_RC_FILE =
if ENV.key?('PRYRC')
ENV['PRYRC']
elsif File.exist?(File.expand_path('~/.pryrc'))
'~/.pryrc'
elsif ENV.key?('XDG_CONFIG_HOME') && ENV['XDG_CONFIG_HOME'] != ''
# See XDG Base Directory Specification at
# https://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html
ENV['XDG_CONFIG_HOME'] + '/pry/pryrc'
else
'~/.config/pry/config'
end
LOCAL_RC_FILE = "./.pryrc"

class << self

0 comments on commit a0be0cc

Please sign in to comment.
You can’t perform that action at this time.