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
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)
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
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'])
$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 =~ /'/
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
#- 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)
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