* Bug #12162 fixed - tbx_build_blocks did not report errors (2). 05/10005/2
Clément DAVID [Wed, 12 Dec 2012 10:23:19 +0000 (11:23 +0100)]
 * More check is performed
 * the erroneous file is displayed
 * driver is also restored in case of error

Change-Id: I5cf8d5956e643e9efe4339334e705e5219ad3074

scilab/modules/modules_manager/macros/tbx_build_blocks.sci
scilab/modules/xcos/macros/generateBlockImage.sci

index fc6de34..414afb0 100644 (file)
@@ -93,19 +93,22 @@ function tbx_build_blocks(module, names, macros_path)
 
         // export an image file if it doesn't exist
         files = gif_tlbx + "/" + names(i) + [".png" ".jpg" ".gif"];
-        if ~or(isfile(files)) then
+        files = files(isfile(files));
+        if files == [] then
+            filename = gif_tlbx + "/" + names(i) + ".gif";
             if ~generateBlockImage(block, gif_tlbx, names(i), "gif", %t) then
-                error(msprintf(gettext("%s: Unable to export %s to %s.\n"),"tbx_build_blocks",names(i), files(i)));
+                error(msprintf(gettext("%s: Unable to export %s to %s.\n"),"tbx_build_blocks",names(i), filename));
             end
         end
 
         // export a schema file if it doesn't exist
         files = svg_tlbx + "/" + names(i) + [".svg" ".png" ".jpg" ".gif"];
-        if ~or(isfile(files)) then
+        files = files(isfile(files));
+        if files == [] then
+            filename = svg_tlbx + "/" + names(i) + ".svg";
             if ~generateBlockImage(block, svg_tlbx, names(i), "svg", %f) then
-                error(msprintf(gettext("%s: Unable to export %s to %s.\n"),"tbx_build_blocks",names(i), files(i)));
+                error(msprintf(gettext("%s: Unable to export %s to %s .\n"),"tbx_build_blocks",names(i), filename));
             end
         end
     end
 endfunction
-
index 2abcd01..4d43b87 100644 (file)
@@ -106,11 +106,14 @@ function status = generateBlockImage(block, path, filename, imageType, withPort)
     end
 
     // export
-    xend();
+    try
+        xend();
+        status = %t;
+    catch
+        status = %f;
+    end
     
     // post operations
     driver(previous_driver);
-
-    status = %t;
 endfunction