From: vsr Date: Sat, 13 Nov 2010 09:51:22 +0000 (+0000) Subject: Merge from BR_WIN_INDUS_514 13/11/2010 X-Git-Tag: RELIQUAT_5x_15112010~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7299591f5f02aa8bd660677cfcbe4810058383ba;p=modules%2Fkernel.git Merge from BR_WIN_INDUS_514 13/11/2010 --- diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index b807edad5..07973f56b 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -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) diff --git a/bin/runSalome.py b/bin/runSalome.py index 13e507638..75b3cff49 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -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 diff --git a/bin/server.py b/bin/server.py index cb5451c62..47f061d89 100755 --- a/bin/server.py +++ b/bin/server.py @@ -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": diff --git a/src/HDFPersist/HDFascii.cc b/src/HDFPersist/HDFascii.cc index 945b482f1..53b344272 100644 --- a/src/HDFPersist/HDFascii.cc +++ b/src/HDFPersist/HDFascii.cc @@ -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; } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx index 62f4e169a..2e2e012ae 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx @@ -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)) { diff --git a/src/TOOLSDS/SALOMEDS_Tool.cxx b/src/TOOLSDS/SALOMEDS_Tool.cxx index a2222ef20..b1b269454 100644 --- a/src/TOOLSDS/SALOMEDS_Tool.cxx +++ b/src/TOOLSDS/SALOMEDS_Tool.cxx @@ -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