Procházet zdrojové kódy

Do a backup when forcing new file

Alois Mahdal před 10 roky
rodič
revize
b708dccea7
1 změnil soubory, kde provedl 4 přidání a 2 odebrání
  1. 4
    2
      bin/mkexec.pl

+ 4
- 2
bin/mkexec.pl Zobrazit soubor

@@ -48,8 +48,10 @@ $cmds->{editor}->{run}  = "editor '%s'";
48 48
 ## ''' ##   # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
49 49
 
50 50
 if (exists $bangs->{$type}) {
51
-    -e $name and not $force
52
-        or mkexec $name, mkbody($type);
51
+    $force and -e $name
52
+        and (defined `cp "$name" "$name~"` or die $!);
53
+    (not -e $name or $force)
54
+        and mkexec $name, mkbody($type);
53 55
     chmod $DEFAULT_MODE, $name;
54 56
     launch_editor $name;
55 57
 } else {