diff options
| -rw-r--r-- | lib/sisu/se_info_env.rb | 6 | ||||
| -rw-r--r-- | lib/sisu/shared_images.rb | 10 | ||||
| -rw-r--r-- | lib/sisu/xhtml_epub2.rb | 9 | ||||
| -rw-r--r-- | org/env.org | 6 | ||||
| -rw-r--r-- | org/shared.org | 10 | ||||
| -rw-r--r-- | org/xhtml.org | 9 | 
6 files changed, 28 insertions, 22 deletions
diff --git a/lib/sisu/se_info_env.rb b/lib/sisu/se_info_env.rb index 6af47f9d..7b9041d1 100644 --- a/lib/sisu/se_info_env.rb +++ b/lib/sisu/se_info_env.rb @@ -1488,10 +1488,10 @@ WOK          : "#{md.opt.sisu_data_dir?}/sisu/image"          images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png]          images.each do |i| #move to avoid repeated tests -          if FileTest.file?("#{src}/#{i}") +          if Pathname#exist?("#{src}/#{i}")              FileUtils::cp("#{src}/#{i}","#{pth}/#{i}") \ -              unless FileTest.file?("#{pth}/#{i}") -          else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} +              unless Pathname#exist?("#{pth}/#{i}") +          else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}] [#{src}/#{i}]}            end          end          pth diff --git a/lib/sisu/shared_images.rb b/lib/sisu/shared_images.rb index ad5269e9..bccf77bd 100644 --- a/lib/sisu/shared_images.rb +++ b/lib/sisu/shared_images.rb @@ -71,19 +71,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__}]} diff --git a/lib/sisu/xhtml_epub2.rb b/lib/sisu/xhtml_epub2.rb index 58ee7672..5ba80da0 100644 --- a/lib/sisu/xhtml_epub2.rb +++ b/lib/sisu/xhtml_epub2.rb @@ -784,10 +784,11 @@ module SiSU_XHTML_EPUB2          end        end        def images -#puts @md.env.path.image_source_include -#puts @md.env.processing_path.epub -#puts @md.env.path.image_source_include_local -puts @md.file.output_path.epub.rel_image +#REMOVE +#puts @md.env.path.image_source_include + '  :  ' + __FILE__ + ':' + __LINE__.to_s +#puts @md.env.processing_path.epub + '  :  ' + __FILE__ + ':' + __LINE__.to_s +#puts @md.env.path.image_source_include_local + '  :  ' + __FILE__ + ':' + __LINE__.to_s +#puts @md.file.output_path.epub.rel_image + '  :  ' + __FILE__ + ':' + __LINE__.to_s          #img_pth=$sisu_base_data + '/image'          img_pth=@md.env.path.image_source_include          img_src_pth=unless @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/ diff --git a/org/env.org b/org/env.org index 87feb912..99e127ae 100644 --- a/org/env.org +++ b/org/env.org @@ -5943,10 +5943,10 @@ WOK          : "#{md.opt.sisu_data_dir?}/sisu/image"          images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png]          images.each do |i| #move to avoid repeated tests -          if FileTest.file?("#{src}/#{i}") +          if Pathname#exist?("#{src}/#{i}")              FileUtils::cp("#{src}/#{i}","#{pth}/#{i}") \ -              unless FileTest.file?("#{pth}/#{i}") -          else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} +              unless Pathname#exist?("#{pth}/#{i}") +          else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}] [#{src}/#{i}]}            end          end          pth 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__}]} diff --git a/org/xhtml.org b/org/xhtml.org index 3aef5c7e..1e57ea74 100644 --- a/org/xhtml.org +++ b/org/xhtml.org @@ -1180,10 +1180,11 @@ module SiSU_XHTML_EPUB2          end        end        def images -#puts @md.env.path.image_source_include -#puts @md.env.processing_path.epub -#puts @md.env.path.image_source_include_local -puts @md.file.output_path.epub.rel_image +#REMOVE +#puts @md.env.path.image_source_include + '  :  ' + __FILE__ + ':' + __LINE__.to_s +#puts @md.env.processing_path.epub + '  :  ' + __FILE__ + ':' + __LINE__.to_s +#puts @md.env.path.image_source_include_local + '  :  ' + __FILE__ + ':' + __LINE__.to_s +#puts @md.file.output_path.epub.rel_image + '  :  ' + __FILE__ + ':' + __LINE__.to_s          #img_pth=$sisu_base_data + '/image'          img_pth=@md.env.path.image_source_include          img_src_pth=unless @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/  | 
