From f5171503e69e89d2693f0ba9c467697e54ce13ac Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Mon, 6 Sep 2010 10:03:26 +0200 Subject: [PATCH] couple more fixes for ruby 1.9 --- bin/album2booh | 2 +- bin/booh | 4 ++-- bin/booh-backend | 4 ++-- bin/booh-classifier | 2 +- bin/webalbum2booh | 2 +- lib/booh/booh-lib.rb | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/album2booh b/bin/album2booh index 211694c..deb37dd 100644 --- a/bin/album2booh +++ b/bin/album2booh @@ -134,7 +134,7 @@ end def walk_source_dir - `find #{$source} -type d`.sort.each { |dir| + `find #{$source} -type d`.split.sort.each { |dir| dir.chomp! msg 2, _("Handling %s from config list...") % dir diff --git a/bin/booh b/bin/booh index a5db624..2d69629 100644 --- a/bin/booh +++ b/bin/booh @@ -2842,7 +2842,7 @@ def theme_choose(current) dialog.vbox.add(sw = Gtk::ScrolledWindow.new(nil, nil).add(treeview).set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC)) - ([ $FPATH + '/themes/simple' ] + (`find '#{$FPATH}/themes' ~/.booh-themes -mindepth 1 -maxdepth 1 -type d 2>/dev/null`.find_all { |e| e !~ /simple$/ }.sort)).each { |dir| + ([ $FPATH + '/themes/simple' ] + (`find '#{$FPATH}/themes' ~/.booh-themes -mindepth 1 -maxdepth 1 -type d 2>/dev/null`.split.find_all { |e| e !~ /simple$/ }.sort)).each { |dir| dir.chomp! iter = model.append iter[0] = File.basename(dir) @@ -2982,7 +2982,7 @@ def open_file(filename) mark_document_as_dirty if $xmldoc.root.attributes['version'] < '0.8.4' msg 1, _("File's version prior to 0.8.4, migrating directories and filenames in destination directory if needed") - `find '#{source}' -type d -follow`.sort.collect { |v| v.chomp }.each { |dir| + `find '#{source}' -type d -follow`.split.sort.collect { |v| v.chomp }.each { |dir| old_dest_dir = make_dest_filename_old(dir.sub(/^#{Regexp.quote(source)}/, dest)) new_dest_dir = make_dest_filename(dir.sub(/^#{Regexp.quote(source)}/, dest)) if old_dest_dir != new_dest_dir diff --git a/bin/booh-backend b/bin/booh-backend index f55de76..03c6be7 100755 --- a/bin/booh-backend +++ b/bin/booh-backend @@ -804,9 +804,9 @@ def walk_source_dir if $mode == 'merge_config_onedir' examined_dirs = [ $onedir ] elsif $mode == 'merge_config_subdirs' - examined_dirs = `find '#{$onedir}' -type d -follow`.sort.collect { |v| v.chomp }.delete_if { |v| optxpath.has_key?(utf8(v)) } + examined_dirs = `find '#{$onedir}' -type d -follow`.split.sort.collect { |v| v.chomp }.delete_if { |v| optxpath.has_key?(utf8(v)) } else - examined_dirs = `find '#{$source}' -type d -follow`.sort.collect { |v| v.chomp } + examined_dirs = `find '#{$source}' -type d -follow`.split.sort.collect { |v| v.chomp } if $mode == 'merge_config' $xmldoc.elements.each('//dir') { |elem| if ! examined_dirs.include?(elem.attributes['path']) diff --git a/bin/booh-classifier b/bin/booh-classifier index 7b25b5f..974f043 100644 --- a/bin/booh-classifier +++ b/bin/booh-classifier @@ -1322,7 +1322,7 @@ def open_dir(*paths) $workingdir = path entries = [] if File.directory?(path) - examined_dirs = `find '#{path}' -type d -follow`.sort.collect { |v| v.chomp } + examined_dirs = `find '#{path}' -type d -follow`.split.sort.collect { |v| v.chomp } #- validate first examined_dirs.each { |dir| if dir =~ /'/ diff --git a/bin/webalbum2booh b/bin/webalbum2booh index 61daaec..eb11813 100644 --- a/bin/webalbum2booh +++ b/bin/webalbum2booh @@ -127,7 +127,7 @@ end def walk_source_dir - `find #{$source} -type d`.sort.each { |dir| + `find #{$source} -type d`.split.sort.each { |dir| dir.chomp! msg 2, _("Handling %s from config list...") % dir diff --git a/lib/booh/booh-lib.rb b/lib/booh/booh-lib.rb index cbead63..08578da 100644 --- a/lib/booh/booh-lib.rb +++ b/lib/booh/booh-lib.rb @@ -107,14 +107,14 @@ module Booh #- we remove non alphanumeric characters but need to do that #- cleverly to not end up with two similar dest filenames. we won't #- urlencode because urldecode might happen in the browser. - return orig_filename.unpack("C*").collect { |v| v.chr =~ /[a-zA-Z\-_0-9\.\/]/ ? v.chr : sprintf("%2X", v) }.to_s + return orig_filename.unpack("C*").collect { |v| v.chr =~ /[a-zA-Z\-_0-9\.\/]/ ? v.chr : sprintf("%2X", v) }.join end def make_dest_filename(orig_filename) #- we remove non alphanumeric characters but need to do that #- cleverly to not end up with two similar dest filenames. we won't #- urlencode because urldecode might happen in the browser. - return orig_filename.unpack("C*").collect { |v| v.chr =~ /[a-zA-Z\-_0-9\.\/]/ ? v.chr : sprintf("~%02X", v) }.to_s + return orig_filename.unpack("C*").collect { |v| v.chr =~ /[a-zA-Z\-_0-9\.\/]/ ? v.chr : sprintf("~%02X", v) }.join end def msg(verbose_level, msg) @@ -535,7 +535,7 @@ module Booh def substInFile(name) newcontent = IO.readlines(name).collect { |l| yield l } ios = File.open(name, "w") - ios.write(newcontent) + ios.write(newcontent.join) ios.close end -- 2.30.4