diff options
Diffstat (limited to 'org/shared.org')
-rw-r--r-- | org/shared.org | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/org/shared.org b/org/shared.org index 34d17bd0..ced99872 100644 --- a/org/shared.org +++ b/org/shared.org @@ -152,19 +152,21 @@ module SiSU_Images def images_set @pwd=(/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1] def copy(src_path,dest_path,images=nil) - if FileTest.directory?(src_path) + require 'pathname' + src_path = Pathname.new(src_path) + dest_path = Pathname.new(dest_path) + if src_path.directory? FileUtils::cd(src_path) unless images images=Dir.glob("*.{png,jpg,gif,ico}") end - unless FileTest.directory?(dest_path) \ - or FileTest.symlink?(dest_path) + unless dest_path.directory? FileUtils::mkdir_p(dest_path) FileUtils::chmod(0755,dest_path) end if images.length > 0 images.each do |i| - if FileTest.file?(i) + if Pathname#exist?(i) FileUtils::cp_r(i,"#{dest_path}/#{i}") FileUtils::chmod(0644,"#{dest_path}/#{i}") else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} |