]> OCCT Git - occt-wok.git/commitdiff
0023229: Avoid overriding existing custom.bat (or .sh) in workbench
authorabv <abv@opencascade.com>
Fri, 13 Jul 2012 12:00:49 +0000 (16:00 +0400)
committerabv <abv@opencascade.com>
Fri, 13 Jul 2012 12:00:49 +0000 (16:00 +0400)
Command wgenproj will not override any more existing custom.bat (.sh) file in the current workbench.
Corrected -force argument and handling of copy failure

src/WOKsite/wok_tclshrc.tcl

index 8aa9ce73b39cb4419e4b85faf188cf09ebae58c1..ea84622f99bb1587788f781a99e0ee500b443211 100644 (file)
@@ -288,11 +288,11 @@ proc wgenprojbat {thePath} {
   close $anEnvFile
 
   if { "$::tcl_platform(platform)" == "windows" } {
-    file copy -force -- "$::env(WOKHOME)/site/custom.bat"        "$aBox/custom.bat"
+    catch {file copy -- "$::env(WOKHOME)/site/custom.bat"        "$aBox/custom.bat"}
     file copy -force -- "$::env(WOKHOME)/lib/templates/draw.bat" "$aBox/draw.bat"
     file copy -force -- "$::env(WOKHOME)/lib/templates/msvc.bat" "$aBox/msvc.bat"
   } else {
-    file copy -force -- "$::env(WOKHOME)/site/custom.sh"         "$aBox/custom.sh"
+    catch {file copy -- "$::env(WOKHOME)/site/custom.sh"         "$aBox/custom.sh"}
   }
 }