check version to import SOD file
[scilab.git] / scilab / modules / hdf5 / sci_gateway / cpp / sci_import_from_hdf5.cpp
index 121a967..10d7752 100644 (file)
@@ -23,6 +23,7 @@ extern "C"
 #include "../../../call_scilab/includes/call_scilab.h"
 #include "h5_fileManagement.h"
 #include "h5_readDataFromFile.h"
+#include "h5_attributeConstants.h"
 #include "intmacr2tree.h"
 #include "expandPathVariable.h"
 }
@@ -96,6 +97,14 @@ int sci_import_from_hdf5(char *fname, unsigned long fname_len)
     FREE(pstExpandedFilename);
     FREE(pstFilename);
 
+    //manage version information
+    int iVersion = getSODFormatAttribute(iFile);
+    if (iVersion > SOD_FILE_VERSION)
+    {//can't read file with version newer that me !
+        Scierror(999, _("%s: Wrong SOD file format version. Max Expected: %d Found: %d\n"), fname, SOD_FILE_VERSION, iVersion);
+        return 1;
+    }
+
     if (iSelectedVar)
     {
         //selected variable