aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rdoc.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-04-23 21:11:21 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-04-23 21:11:21 +0900
commit03e4eeabbf3bbb5a467956920705bf346d790efa (patch)
tree588ad7ca9faa6819cd620c61d134a051c0ca95d4 /lib/rdoc.rb
parent5c6269c4593f8b1a83b72e157c460dd2b37338c7 (diff)
downloadruby-03e4eeabbf3bbb5a467956920705bf346d790efa.tar.gz
Skip the initialization of XDG_DATA_HOME with Permission denied
Diffstat (limited to 'lib/rdoc.rb')
-rw-r--r--lib/rdoc.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/rdoc.rb b/lib/rdoc.rb
index a05391d769..2d3f8c1122 100644
--- a/lib/rdoc.rb
+++ b/lib/rdoc.rb
@@ -129,12 +129,15 @@ module RDoc
if File.directory?(rdoc_dir)
rdoc_dir
else
- # XDG
- xdg_data_home = ENV["XDG_DATA_HOME"] || File.join(File.expand_path("~"), '.local', 'share')
- unless File.exist?(xdg_data_home)
- FileUtils.mkdir_p xdg_data_home
+ begin
+ # XDG
+ xdg_data_home = ENV["XDG_DATA_HOME"] || File.join(File.expand_path("~"), '.local', 'share')
+ unless File.exist?(xdg_data_home)
+ FileUtils.mkdir_p xdg_data_home
+ end
+ File.join xdg_data_home, "rdoc"
+ rescue Errno::EACCES
end
- File.join xdg_data_home, "rdoc"
end
end