]> rtime.felk.cvut.cz Git - fpga/virtex2/msp_motion.git/blobdiff - build/create.tcl
File existence checking
[fpga/virtex2/msp_motion.git] / build / create.tcl
index 7009a91c2aad85398c974f826b5897c3b126dc7e..5f7e5fba757498e2abcc6f0dc0b3700f6ee85a30 100644 (file)
@@ -16,15 +16,20 @@ proc xfile_add_prj prj {
            set lib [lindex $list 1]
            set src $dir/[lindex $list 2]
 
-           puts [format "Adding (%s) %s" $lib $src]
-
-           xfile add $src
+           if {[file exists $src]} {
+               puts [format "Adding (%s) %s" $lib $src]
+               xfile add $src
+           } else {
+               puts [format "ERROR: file %s does not exist..." $src]
+               throw {NOTEXISTS} {"Non-existing file"}
+           }
        }
     }
 
     close $f
 }
 
+
 #===============================================================================
 
 if {$argc < 2} {
@@ -32,11 +37,17 @@ if {$argc < 2} {
     exit 1
 }
 
-
-project new [lindex $argv 0]
+set ise [lindex $argv 0]
+project new $ise
 
 for {set i 1} {$i < $argc} {incr i} {
-    xfile_add_prj [lindex $argv $i]
+    set prj [lindex $argv $i]
+
+    if {[catch {xfile_add_prj $prj}]} {
+       project close
+       file delete $ise
+       exit 1
+    }
 }
 
 project close