tempfile behaviour changed in ruby 1.8.7 :/
authorGuillaume Cottenceau <gcottenc@gmail.com>
Mon, 9 Jun 2008 22:36:00 +0000 (00:36 +0200)
committerGuillaume Cottenceau <gcottenc@gmail.com>
Mon, 9 Jun 2008 22:36:00 +0000 (00:36 +0200)
bin/booh
bin/booh-classifier
lib/booh/booh-lib.rb

index fbc1864..ce1f20e 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -2077,11 +2077,12 @@ end
 def call_backend(cmd, waitmsg, mode, params)
     pipe = Tempfile.new("boohpipe")
     Thread.critical = true
+    path = pipe.path
     pipe.close!
-    system("mkfifo #{pipe.path}")
+    system("mkfifo #{path}")
     Thread.critical = false
-    cmd += " --info-pipe #{pipe.path}"
-    button, w8 = backend_wait_message($main_window, waitmsg, pipe.path, mode)
+    cmd += " --info-pipe #{path}"
+    button, w8 = backend_wait_message($main_window, waitmsg, path, mode)
     pid = nil
     Thread.new {
         msg 2, cmd
@@ -2906,9 +2907,10 @@ def open_file_user(filename)
         $main_window.title = 'booh - ' + File.basename($orig_filename)
         tmp = Tempfile.new("boohtemp")
         Thread.critical = true
+        $filename = tmp.path
         tmp.close!
         #- for security
-        ios = File.open($filename = tmp.path, File::RDWR|File::CREAT|File::EXCL)
+        ios = File.open($filename, File::RDWR|File::CREAT|File::EXCL)
         Thread.critical = false
         ios.close
         $tempfiles << $filename << "#{$filename}.backup"
index 10f1bde..e7005ce 100644 (file)
@@ -409,8 +409,9 @@ class Entry
         pixbuf = nil
         if @type == 'video'
             tmp = Tempfile.new("boohclassifiertemp")
+            dest_dir = tmp.path
             tmp.close!
-            Dir.mkdir(dest_dir = tmp.path)
+            Dir.mkdir(dest_dir)
             orig_base = File.basename(path)
             tmpdir = gen_video_thumbnail(path, false, 0)
             if tmpdir.nil?
index c0d87fd..1678481 100644 (file)
@@ -336,11 +336,12 @@ module Booh
         #- be called from multiple threads, we must come up with a unique directory where to put the file
         tmpfile = Tempfile.new("boohvideotmp")
         Thread.critical = true
+        tmpdirname = tmpfile.path
         tmpfile.close!
         begin
-            Dir.mkdir(tmpdirname = tmpfile.path)
+            Dir.mkdir(tmpdirname)
         rescue Errno::EEXIST
-            raise "Tmp directory #{tmpfile.path} already exists"
+            raise "Tmp directory #{tmpdirname} already exists"
         ensure
             Thread.critical = false
         end