From 461f3abb89dea1879a58d3b5c69dde0d9ba545b2 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 4 Oct 2010 12:04:26 +0000 Subject: [PATCH] Merge from BR_WIN_INDUS_514 04/10/2010 --- src/Container/SALOME_ContainerManager.cxx | 6 ++++-- src/HDFPersist/HDFascii.cc | 23 ++++------------------- src/HDFPersist/HDFdatasetRead.c | 4 ++-- src/Utils/Utils_Identity.py | 2 +- 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 81fdcccc0..4d5a9db91 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -411,7 +411,9 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param #ifdef WNT std::string logFilename=getenv("TEMP"); logFilename += "\\"; + std::string user = getenv( "USERNAME" ); #else + std::string user = getenv( "USER" ); std::string logFilename="/tmp"; char* val = getenv("SALOME_TMP_DIR"); if(val) @@ -424,7 +426,7 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param } logFilename += "/"; #endif - logFilename += _NS->ContainerName(params)+"_"+ resource_selected +"_"+getenv( "USER" ) ; + logFilename += _NS->ContainerName(params)+"_"+ resource_selected +"_"+user; std::ostringstream tmp; tmp << "_" << getpid(); logFilename += tmp.str(); @@ -474,7 +476,7 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param // Setting log file name logFilename=":"+logFilename; logFilename="@"+Kernel_Utils::GetHostname()+logFilename; - logFilename=getenv( "USER" )+logFilename; + logFilename=user+logFilename; ret->logfilename(logFilename.c_str()); RmTmpFile(_TmpFileName); // command file can be removed here } diff --git a/src/HDFPersist/HDFascii.cc b/src/HDFPersist/HDFascii.cc index c138caab6..945b482f1 100644 --- a/src/HDFPersist/HDFascii.cc +++ b/src/HDFPersist/HDFascii.cc @@ -667,20 +667,12 @@ bool CreateAttributeFromASCII(HDFinternalObject *father, FILE* fp) //============================================================================ std::string GetTmpDir() { - //Find a temporary directory to store a file - std::string aTmpDir; - char *Tmp_dir = getenv("SALOME_TMP_DIR"); if(Tmp_dir != NULL) { aTmpDir = std::string(Tmp_dir); if(aTmpDir[aTmpDir.size()-1] != dir_separator) aTmpDir+=dir_separator; -/*#ifdef WIN32 - if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\'; -#else - if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/'; -#endif*/ } else { #ifdef WIN32 @@ -700,16 +692,9 @@ std::string GetTmpDir() aTmpDir += aSubDir; //Get RND sub directory if(aTmpDir[aTmpDir.size()-1] != dir_separator) aTmpDir+=dir_separator; -/* -#ifdef WIN32 - if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\'; -#else - if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/'; -#endif - */ std::string aDir = aTmpDir; - + for(aRND = 0; Exists(aDir); aRND++) { sprintf(buffer, "%d", aRND); aDir = aTmpDir+buffer; //Build a unique directory name @@ -782,10 +767,10 @@ void read_float64(FILE* fp, hdf_float64* value) bool Exists(const std::string thePath) { #ifdef WIN32 - if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) { - if ( GetLastError () != ERROR_FILE_NOT_FOUND ) { + if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) { + DWORD errorId = GetLastError (); + if ( errorId == ERROR_FILE_NOT_FOUND || errorId == ERROR_PATH_NOT_FOUND ) return false; - } } #else int status = access ( thePath.c_str() , F_OK ); diff --git a/src/HDFPersist/HDFdatasetRead.c b/src/HDFPersist/HDFdatasetRead.c index 843f2d717..e3dc6b13a 100644 --- a/src/HDFPersist/HDFdatasetRead.c +++ b/src/HDFPersist/HDFdatasetRead.c @@ -46,10 +46,10 @@ hdf_err HDFdatasetRead(hdf_idt id, void *val) if ((datatype = H5Dget_type(id)) < 0) return -1; -#if defined (PCLINUX) || defined (PCLINUX64) +//#if defined (PCLINUX) || defined (PCLINUX64) if ((H5Tget_class(datatype) == H5T_INTEGER) && (H5Tget_size(datatype) == 4)) datatype = H5T_NATIVE_INT; -#endif +//#endif if ((ret = H5Dread(id,datatype,H5S_ALL,H5S_ALL,H5P_DEFAULT, val)) < 0) return -1; diff --git a/src/Utils/Utils_Identity.py b/src/Utils/Utils_Identity.py index f7a9af420..e55406a31 100644 --- a/src/Utils/Utils_Identity.py +++ b/src/Utils/Utils_Identity.py @@ -59,7 +59,7 @@ class Identity: self._adip = socket.gethostbyname(self._machine) # IP adress if sys.platform == "win32": self._uid = os.getpid() - self._pwname = os.environ["USER"] + self._pwname = os.environ["USERNAME"] else: self._uid = os.getuid() list = pwd.getpwuid(self._uid) -- 2.39.2