]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Merge from BR_WIN_INDUS_514 13/11/2010
authorvsr <vsr@opencascade.com>
Sat, 13 Nov 2010 09:51:22 +0000 (09:51 +0000)
committervsr <vsr@opencascade.com>
Sat, 13 Nov 2010 09:51:22 +0000 (09:51 +0000)
bin/launchConfigureParser.py
bin/runSalome.py
bin/server.py
src/HDFPersist/HDFascii.cc
src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx
src/TOOLSDS/SALOMEDS_Tool.cxx

index b807edad5bd7b83177e79d667b6d9c1ca4779b00..07973f56b1b3baac84efaa3274dd2c830eac5743 100755 (executable)
@@ -910,7 +910,10 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"):
     if cmd_opts.py_scripts is not None:
         listlist = cmd_opts.py_scripts
         for listi in listlist:
-            args[script_nam] += re.split( "[:;,]", listi)
+           if os.sys.platform == 'win32':
+                args[script_nam] += re.split( "[;,]", listi)
+           else:
+                args[script_nam] += re.split( "[:;,]", listi)
     for arg in cmd_args:
         if arg[-3:] == ".py":
             args[script_nam].append(arg)
index 13e507638e84d7ffe727e5d376f01f5e77bf1e37..75b3cff497e82c78134fdc2bb82710cb1cea92d7 100755 (executable)
@@ -92,8 +92,11 @@ def kill_salome(args):
 class InterpServer(Server):
     def __init__(self,args):
         self.args=args
-        env_ld_library_path=['env', 'LD_LIBRARY_PATH=' + os.getenv("LD_LIBRARY_PATH")]
-        self.CMD=['xterm', '-e']+ env_ld_library_path + ['python']
+        if sys.platform != "win32":
+          env_ld_library_path=['env', 'LD_LIBRARY_PATH=' + os.getenv("LD_LIBRARY_PATH")]
+          self.CMD=['xterm', '-e']+ env_ld_library_path + ['python']
+        else:
+          self.CMD=['cmd', '/c', 'start cmd.exe', '/K', 'python']
        
     def run(self):
         global process_id
@@ -589,7 +592,10 @@ def startSalome(args, modules_list, modules_root_dir):
     # set PYTHONINSPECT variable (python interpreter in interactive mode)
     if args['pinter']:
         os.environ["PYTHONINSPECT"]="1"
-        import readline
+        try:
+            import readline
+        except ImportError:
+            pass
         
     return clt
 
index cb5451c62c4ed48e064c1bbab16c5f62eeeb5a18..47f061d89b0292d65f915946b36a690b4ad2c8bd 100755 (executable)
@@ -38,7 +38,10 @@ class Server:
         self.CMD=[]
         self.ARGS=[]
         if self.args.get('xterm'):
+          if sys.platform != "win32":
             self.ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-hold']
+          else:
+            self.ARGS=['cmd', '/c', 'start  cmd.exe', '/K']
 
     def __init__(self,args):
         self.args=args
@@ -50,9 +53,10 @@ class Server:
         myargs=self.ARGS
         if self.args.get('xterm'):
             # (Debian) send LD_LIBRARY_PATH to children shells (xterm)
-            env_ld_library_path=['env', 'LD_LIBRARY_PATH='
-                                 + os.getenv("LD_LIBRARY_PATH")]
-            myargs = myargs +['-T']+self.CMD[:1]+['-e'] + env_ld_library_path
+            if sys.platform != "win32":
+              env_ld_library_path=['env', 'LD_LIBRARY_PATH='
+                                   + os.getenv("LD_LIBRARY_PATH")]
+              myargs = myargs +['-T']+self.CMD[:1]+['-e'] + env_ld_library_path
         command = myargs + self.CMD
         #print "command = ", command
         if sys.platform == "win32":
index 945b482f1a2bcd5c0a48b932fa119215ae1cab8d..53b3442724ba9bf86f72cddf03404e6af53404cb 100644 (file)
@@ -123,7 +123,7 @@ char* HDFascii::ConvertFromHDFToASCII(const char* thePath,
   char name[HDF_NAME_MAX_LEN+1];
   int nbsons = hdf_file->nInternalObjects(), nbAttr = hdf_file->nAttributes(); 
 
-  FILE* fp = fopen(aFileName.c_str(), "w");
+  FILE* fp = fopen(aFileName.c_str(), "wb");
   fprintf(fp, "%s\n", ASCIIHDF_ID);
   fprintf(fp, "%i\n", nbsons+nbAttr);
 
@@ -386,7 +386,7 @@ char* HDFascii::ConvertFromASCIIToHDF(const char* thePath,
     aFullName = std::string(thePath)+".ascii_tmp";
   }
 
-  FILE *fp = fopen(thePath, "r");
+  FILE *fp = fopen(thePath, "rb");
   if(!fp) return NULL;
 
   HDFfile *hdf_file = new HDFfile((char*)aFullName.c_str()); 
@@ -446,6 +446,8 @@ char* HDFascii::ConvertFromASCIIToHDF(const char* thePath,
   char *new_str = new char[ 1+length ];
   strcpy(new_str , aTmpDir.c_str()) ;
 
+  fclose(fp);
+
   return new_str;
 }
 
index 62f4e169adbeedf15d73e82fb9fc77fd8dadcbab..2e2e012aec05ef5597c30bb3e908fcbcb1d1b2d7 100644 (file)
@@ -137,6 +137,8 @@ SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::Open(const std::string& aUrl)
   if (HDFascii::isASCII(aUrl.c_str())) {
     isASCII = true;
     char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aUrl.c_str());
+    if ( !aResultPath )
+      return NULL;
     aC_HDFUrl = new char[strlen(aResultPath) + 19];
     sprintf(aC_HDFUrl, "%shdf_from_ascii.hdf", aResultPath);
     delete [] (aResultPath);
@@ -152,15 +154,15 @@ SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::Open(const std::string& aUrl)
     hdf_file->OpenOnDisk(HDF_RDONLY);// mpv: was RDWR, but opened file can be write-protected too
   }
   catch (HDFexception)
-    {
-        char *eStr;
-        eStr = new char[strlen(aUrl.c_str())+17];
-        sprintf(eStr,"Can't open file %s",aUrl.c_str());
-         delete [] eStr;
-        _errorCode = std::string(eStr);
-        return NULL;
-    }
-
+  {
+    char *eStr;
+    eStr = new char[strlen(aUrl.c_str())+17];
+    sprintf(eStr,"Can't open file %s",aUrl.c_str());
+    delete [] eStr;
+    _errorCode = std::string(eStr);
+    return NULL;
+  }
+  
   // Temporary aStudyUrl in place of study name
   DF_Document* Doc = _appli->NewDocument("SALOME_STUDY");
 
@@ -186,13 +188,13 @@ SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::Open(const std::string& aUrl)
     BuildTree (Study, hdf_group_study_structure);
   }
   catch (HDFexception)
-    {
-      char *eStr = new char [strlen(aUrl.c_str())+17];
-      sprintf(eStr,"Can't open file %s", aUrl.c_str());
-      _errorCode = std::string(eStr);
-      return NULL;
-    }
-
+  {
+    char *eStr = new char [strlen(aUrl.c_str())+17];
+    sprintf(eStr,"Can't open file %s", aUrl.c_str());
+    _errorCode = std::string(eStr);
+    return NULL;
+  }
+  
   //Read and create notebook variables 
   if(hdf_file->ExistInternalObject("NOTEBOOK_VARIABLES")) {
     hdf_notebook_vars  = new HDFgroup("NOTEBOOK_VARIABLES",hdf_file);
@@ -770,7 +772,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const std::string& aStudyUrl,
   system(aCmd.c_str());
 
   //       Iterate and move files in the temporary directory
-  FILE* fp = fopen(aTmpFile.c_str(), "r");
+  FILE* fp = fopen(aTmpFile.c_str(), "rb");
   if(!fp) return false;
   char* buffer = new char[2047];
   while(!feof(fp)) {
index a2222ef20f7ecf5305f378aca28127a129570afe..b1b2694542fcefabccba783380571d766487be69 100644 (file)
@@ -330,6 +330,13 @@ SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
     char *aFileName = new char[aFileNameSize];
     //Put a file name to aFileName
     memcpy(aFileName, (aBuffer + aCurrentPos), aFileNameSize); 
+#ifdef WIN32
+    for (int i = 0; i < strlen(aFileName); i++)
+    {
+      if (aFileName[i] == ':')
+       aFileName[i] = '_';
+    }
+#endif
     aCurrentPos += aFileNameSize;
  
     //Put a length of the file to aFileSize