[Kazehakase-cvs] CVS update: kazehakase/data/ext/ruby/kz/actions

Back to archive index

Kouhei Sutou kous****@users*****
Fri Jun 9 11:27:54 JST 2006


Index: kazehakase/data/ext/ruby/kz/actions/view-pdf-as-image.rb
diff -u kazehakase/data/ext/ruby/kz/actions/view-pdf-as-image.rb:1.6 kazehakase/data/ext/ruby/kz/actions/view-pdf-as-image.rb:1.7
--- kazehakase/data/ext/ruby/kz/actions/view-pdf-as-image.rb:1.6	Thu Jun  8 22:39:19 2006
+++ kazehakase/data/ext/ruby/kz/actions/view-pdf-as-image.rb	Fri Jun  9 11:27:54 2006
@@ -34,6 +34,10 @@
   def text_html
     "text.html"
   end
+
+  def filename_escape(uri)
+    uri.split(/[:\/]/).join("_")
+  end
 end
 
 extend Util
@@ -41,15 +45,14 @@
 def ruby_poppler_is_unavailable(action, kz)
   statusbar_timeout = 3 * 1000
   name = action.name
-  kz.statusbar.push(_("need to install Ruby/Poppler"), name)
+  kz.statusbar.set_text(_("need to install Ruby/Poppler"), name)
   Kz.pop_statusbar(kz, name, statusbar_timeout)
 end
 
 def start_downloader(kz, uri)
-  tmp_dir = "/tmp/kazehakase"
+  tmp_dir = File.join(TMP_DIR, filename_escape(uri))
   FileUtils.mkdir_p(tmp_dir)
-  Kz.add_exit_proc {FileUtils.rm_rf(tmp_dir)}
-  filename = File.join(tmp_dir, File.basename(uri))
+  filename = File.join(TMP_DIR, filename_escape(File.basename(uri)))
   dl = Kz::Downloader.new(uri, filename)
   dl.signal_connect("completed") do
     Kz.barrier do


More information about the Kazehakase-cvs mailing list
Back to archive index