end
if !$source && $xmldoc
- $source = $xmldoc.root.attributes['source']
- $dest = $xmldoc.root.attributes['destination']
+ $source = from_utf8($xmldoc.root.attributes['source'])
+ $dest = from_utf8($xmldoc.root.attributes['destination'])
$theme = $xmldoc.root.attributes['theme']
$limit_sizes = $xmldoc.root.attributes['limit-sizes']
end
def walk_source_dir
- `find #{$source} -type d`.sort.each { |dir|
+ `find '#{$source}' -type d`.sort.each { |dir|
dir.chomp!
if dir =~ /'/
die _("Source directory or sub-directories can't contain a single-quote character, sorry.")
entries = Dir.entries(dir).sort
#- populate config in case of gen_config, add new files in case of merge_config
for file in entries
- type = entry2type(file)
- if type && !xmldir.elements["#{type}[@filename='#{utf8(file)}']"]
- xmldir.add_element type, { "filename" => utf8(file), "caption" => utf8(file.sub(/\.[^\.]+$/, '')[0..17]) }
+ if file =~ /['"\(\)\[\]]/
+ msg 1, _("Ignoring %s, contains one of forbidden characters: '\"()[]") % "#{dir}/#{file}"
+ else
+ type = entry2type(file)
+ if type && !xmldir.elements["#{type}[@filename='#{utf8(file)}']"]
+ xmldir.add_element type, { "filename" => utf8(file), "caption" => utf8(file.sub(/\.[^\.]+$/, '')[0..17]) }
+ end
end
end
if $mode == 'merge_config'
#- second pass to create index.html files
msg 3, _("\trescanning directories to generate all `index.html' files...")
- `find #{$source} -type d`.each { |dir|
+ `find '#{$source}' -type d`.each { |dir|
dir.chomp!
xmldir = $xmldoc.elements["//dir[@path='#{utf8(dir)}']"]
if !xmldir
def current_dest_dir
source = $xmldoc.root.attributes['source']
dest = $xmldoc.root.attributes['destination']
- return make_dest_filename(from_utf8($current_path).sub(/^#{Regexp.quote(source)}/, dest))
+ return make_dest_filename($current_path.sub(/^#{Regexp.quote(source)}/, dest))
end
def build_full_dest_filename(filename)
def view_element(filename)
if entry2type(filename) == 'video'
- system("mplayer #{$current_path + '/' + filename}")
+ system("mplayer '#{from_utf8($current_path + '/' + filename)}'")
return
end
evt = Gtk::EventBox.new.add(Gtk::Alignment.new(0.5, 0.5, 0, 0).add(Gtk::Frame.new.add(Gtk::Image.new(dest_img)).set_shadow_type(Gtk::SHADOW_ETCHED_OUT)))
tooltips = Gtk::Tooltips.new
- tooltips.set_tip(evt, utf8(File.basename(filename).gsub(/\.jpg/, '')), nil)
+ tooltips.set_tip(evt, File.basename(filename).gsub(/\.jpg/, ''), nil)
bottom = Gtk::Alignment.new(0.5, 0.5, 0, 0).add(b = Gtk::Button.new(Gtk::Stock::CLOSE))
b.signal_connect('clicked') { w.destroy }
evtbox = Gtk::EventBox.new.add(Gtk::Alignment.new(0.5, 0.5, 0, 0).add(frame1.set_shadow_type(Gtk::SHADOW_ETCHED_OUT)))
tooltips = Gtk::Tooltips.new
- tipname = File.basename(thumbnail_img).gsub(/-\d+x\d+\.jpg/, '')
+ tipname = from_utf8(File.basename(filename).gsub(/\.[^\.]+$/, ''))
tooltips.set_tip(evtbox, utf8(type == 'video' ? (_("%s (video - %s KB)") % [tipname, commify(file_size(from_utf8("#{$current_path}/#{filename}"))/1024)]) : tipname), nil)
frame2, textview = create_editzone($autotable_sw, 1)
src_nb_thread = Thread.new {
src_nb.set_markup(utf8(_("<span size='small'><i>processing...</i></span>")))
total = { 'image' => 0, 'video' => 0, nil => 0 }
- `find #{from_utf8(src_nb_calculated_for)} -type d`.each { |dir|
+ `find '#{from_utf8(src_nb_calculated_for)}' -type d`.each { |dir|
begin
Dir.entries(dir.chomp).each { |file|
total[entry2type(file)] += 1
elsif conf.text == ''
show_popup(dialog, utf8(_("Please specify a filename to store the album's properties.")))
conf.grab_focus
+ elsif destdir != make_dest_filename(destdir)
+ show_popup(dialog, utf8(_("Sorry, destination directory can't contain non simple alphanumeric characters.")))
+ dest.grab_focus
elsif File.directory?(destdir)
keepon = !show_popup(dialog, utf8(_("The destination directory already exists. Are you sure you want to continue?")), { :okcancel => true })
dest.grab_focus
Gtk.timeout_remove(timeout_src_nb)
if ok
- perform_in_background("booh --source #{srcdir} --destination #{destdir} --config-skel #{configskel} --for-gui " +
+ perform_in_background("booh --source '#{srcdir}' --destination '#{destdir}' --config-skel '#{configskel}' --for-gui " +
"--verbose-level #{$verbose_level} --theme #{theme} --sizes #{sizes} #{additional_booh_options}",
utf8(_("Please wait while scanning source directory...")),
{ :closure_after => proc { open_file(configskel) } })
dialog.destroy
if ok && (save_theme != theme || save_limit_sizes != limit_sizes)
- perform_in_background("booh --merge-config #{$filename} --for-gui " +
+ perform_in_background("booh --merge-config '#{$filename}' --for-gui " +
"--verbose-level #{$verbose_level} --theme #{theme} --sizes #{save_limit_sizes.join(',')} #{additional_booh_options}",
utf8(_("Please wait while scanning source directory...")),
{ :closure_after => proc { open_file($filename) } })
if limit_sizes
limit_sizes = "--sizes #{limit_sizes}"
end
- perform_in_background("booh --merge-config #{$filename} --for-gui " +
+ perform_in_background("booh --merge-config '#{$filename}' --for-gui " +
"--verbose-level #{$verbose_level} --theme #{theme} #{limit_sizes} #{additional_booh_options}",
utf8(_("Please wait while scanning source directory...")),
{ :closure_after => proc { open_file($filename) } })
$merge.signal_connect('activate') { merge }
$generate.signal_connect('activate') {
save_current_file
- perform_in_background("booh --config #{$filename} --verbose-level #{$verbose_level} #{additional_booh_options}",
+ perform_in_background("booh --config '#{$filename}' --verbose-level #{$verbose_level} #{additional_booh_options}",
utf8(_("Please wait while generating web-album...\nThis may take a while, please be patient.")),
{ :successmsg => utf8(_("Your web-album is now ready in directory `%s'.") % $xmldoc.root.attributes['destination'] ),
:failuremsg => utf8(_("There was something wrong when generating the web-album, sorry.")) })