try to use hard links when creating an album including "original" size to space diskspace
authorgc <gc>
Sat, 5 Nov 2005 18:40:00 +0000 (18:40 +0000)
committergc <gc>
Sat, 5 Nov 2005 18:40:00 +0000 (18:40 +0000)
bin/booh-backend

index 37d6be032b7717f8377a5c4d946025bbae188a53..bcb7fb3406ca700c0360f0c01b719bc62d1768cf 100755 (executable)
@@ -70,6 +70,7 @@ $stdout.sync = true
 $no_identify = false
 $ignore_videos = false
 $forgui = false
 $no_identify = false
 $ignore_videos = false
 $forgui = false
+$hardlinks_ok = true
 
 def usage
     puts _("Usage: %s [OPTION]...") % File.basename($0)
 
 def usage
     puts _("Usage: %s [OPTION]...") % File.basename($0)
@@ -762,7 +763,14 @@ def walk_source_dir
                 end
                 destimg = "#{dest_dir}/#{img}"
                 if $limit_sizes =~ /original/ && !File.exists?(destimg)
                 end
                 destimg = "#{dest_dir}/#{img}"
                 if $limit_sizes =~ /original/ && !File.exists?(destimg)
-                    psys("cp '#{dir}/#{img}' '#{destimg}'")
+                    if $hardlinks_ok
+                        if ! sys("ln '#{dir}/#{img}' '#{destimg}'")
+                            $hardlinks_ok = false
+                        end
+                    end
+                    if ! $hardlinks_ok
+                        psys("cp '#{dir}/#{img}' '#{destimg}'")
+                    end
                 end
             end
         }
                 end
             end
         }