[前][次][番号順一覧][スレッド一覧]

ruby-changes:60883

From: Hiroshi <ko1@a...>
Date: Thu, 23 Apr 2020 21:11:41 +0900 (JST)
Subject: [ruby-changes:60883] 03e4eeabbf (master): Skip the initialization of XDG_DATA_HOME with Permission denied

https://git.ruby-lang.org/ruby.git/commit/?id=03e4eeabbf

From 03e4eeabbf3bbb5a467956920705bf346d790efa Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Thu, 23 Apr 2020 21:11:21 +0900
Subject: Skip the initialization of XDG_DATA_HOME with Permission denied


diff --git a/lib/rdoc.rb b/lib/rdoc.rb
index a05391d..2d3f8c1 100644
--- a/lib/rdoc.rb
+++ b/lib/rdoc.rb
@@ -129,12 +129,15 @@ module RDoc https://github.com/ruby/ruby/blob/trunk/lib/rdoc.rb#L129
     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
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]