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)
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
# 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
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
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":
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);
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());
char *new_str = new char[ 1+length ];
strcpy(new_str , aTmpDir.c_str()) ;
+ fclose(fp);
+
return new_str;
}
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);
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");
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);
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)) {
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