use more File.delete and File.join
[booh] / bin / booh-backend
index 14bdb9f1c3e35de59db1162237c57c8c3480a9a7..1412c8452e677f3ed4c172fb275d79b2c7889959 100755 (executable)
@@ -805,15 +805,15 @@ def walk_source_dir
                         subdir = make_dest_filename(from_utf8(File.basename(child.attributes['path'])))
                         rightful_images << "thumbnails-#{subdir}.jpg"
                     }
                         subdir = make_dest_filename(from_utf8(File.basename(child.attributes['path'])))
                         rightful_images << "thumbnails-#{subdir}.jpg"
                     }
-                    to_del = Dir.entries(dest_dir).find_all { |e| !File.directory?("#{dest_dir}/#{e}") && !rightful_images.include?(e) } - themestuff - themestuff_root
+                    to_del = Dir.entries(dest_dir).find_all { |e| !File.directory?(File.join(dest_dir, e)) && !rightful_images.include?(e) } - themestuff - themestuff_root
                     if to_del.size > 0
                     if to_del.size > 0
-                        system("rm -f " + to_del.collect { |e| "'#{dest_dir}/#{e}'" }.join(' '))
+                        File.delete(to_del.collect { |e| File.join(dest_dir, e) })
                     end
                 end
                 
                 #- copy any resource file that goes with the theme (css, images..)
                 themestuff.each { |entry|
                     end
                 end
                 
                 #- copy any resource file that goes with the theme (css, images..)
                 themestuff.each { |entry|
-                    if !File.exists?("#{dest_dir}/#{entry}")
+                    if !File.exists?(File.join(dest_dir, entry))
                         psys("cp '#{$FPATH}/themes/#{$theme}/#{entry}' '#{dest_dir}'")
                     end
                 }
                         psys("cp '#{$FPATH}/themes/#{$theme}/#{entry}' '#{dest_dir}'")
                     end
                 }
@@ -821,7 +821,7 @@ def walk_source_dir
                 #- copy any root-only resource file that goes with the theme (css, images..)
                 if xmldir.parent.name != 'dir'
                     themestuff_root.each { |entry|
                 #- copy any root-only resource file that goes with the theme (css, images..)
                 if xmldir.parent.name != 'dir'
                     themestuff_root.each { |entry|
-                        if !File.exists?("#{dest_dir}/#{entry}")
+                        if !File.exists?(File.join(dest_dir, entry))
                             psys("cp '#{$FPATH}/themes/#{$theme}/root/#{entry}' '#{dest_dir}'")
                         end
                     }
                             psys("cp '#{$FPATH}/themes/#{$theme}/root/#{entry}' '#{dest_dir}'")
                         end
                     }
@@ -934,15 +934,15 @@ def walk_source_dir
                      concat(thumbnail_videos.collect { |e| e[1] }.flatten).
                      concat(videos).
                      push('.htaccess')
                      concat(thumbnail_videos.collect { |e| e[1] }.flatten).
                      concat(videos).
                      push('.htaccess')
-            to_del = Dir.entries(dest_dir).find_all { |e| !File.directory?("#{dest_dir}/#{e}") && !all_elements.include?(e) && e !~ /^thumbnails-\w+\.jpg/ } - themestuff - themestuff_root
+            to_del = Dir.entries(dest_dir).find_all { |e| !File.directory?(File.join(dest_dir, e)) && !all_elements.include?(e) && e !~ /^thumbnails-\w+\.jpg/ } - themestuff - themestuff_root
             if to_del.size > 0
                 msg 3, _("\tcleaning up: #{to_del.join(', ')}")
             if to_del.size > 0
                 msg 3, _("\tcleaning up: #{to_del.join(', ')}")
-                system("rm -f " + to_del.collect { |e| "#{dest_dir}/#{e}" }.join(' '))
+                File.delete(to_del.collect { |e| File.join(dest_dir, e) })
             end
 
             #- copy any resource file that goes with the theme (css, images..)
             themestuff.each { |entry|
             end
 
             #- copy any resource file that goes with the theme (css, images..)
             themestuff.each { |entry|
-                if !File.exists?("#{dest_dir}/#{entry}")
+                if !File.exists?(File.join(dest_dir, entry))
                     psys("cp '#{$FPATH}/themes/#{$theme}/#{entry}' '#{dest_dir}'")
                 end
             }
                     psys("cp '#{$FPATH}/themes/#{$theme}/#{entry}' '#{dest_dir}'")
                 end
             }
@@ -950,7 +950,7 @@ def walk_source_dir
             #- copy any root-only resource file that goes with the theme (css, images..)
             if xmldir.parent.name != 'dir'
                 themestuff_root.each { |entry|
             #- copy any root-only resource file that goes with the theme (css, images..)
             if xmldir.parent.name != 'dir'
                 themestuff_root.each { |entry|
-                    if !File.exists?("#{dest_dir}/#{entry}")
+                    if !File.exists?(File.join(dest_dir, entry))
                         psys("cp '#{$FPATH}/themes/#{$theme}/root/#{entry}' '#{dest_dir}'")
                     end
                 }
                         psys("cp '#{$FPATH}/themes/#{$theme}/root/#{entry}' '#{dest_dir}'")
                     end
                 }