#endif
#endif
+#ifdef WIN32\r
+\r
+//Converts char* to windows wchar_t*\r
+wchar_t* ConvertToWideChar(const char* multibytearray) {\r
+ int wchars_num = MultiByteToWideChar( CP_UTF8 , 0 , multibytearray , -1, NULL , 0 );\r
+ wchar_t* wstr = new wchar_t[wchars_num];\r
+ MultiByteToWideChar( CP_UTF8 , 0 , multibytearray , -1, wstr , wchars_num );\r
+ return wstr;\r
+}\r
+\r
+//Converts std::string to windows std::wstring\r
+std::wstring ConvertToWideString(std::string multibytearray) {\r
+ wchar_t* wstr = ConvertToWideChar(multibytearray.c_str());\r
+ std::wstring result(wstr);\r
+ delete[] wstr;\r
+ return result;\r
+}\r
+#endif\r
+
}
BASICS_EXPORT int setenv(const char*, const char*, int);
#endif
#endif
+
+#ifdef WIN32
+ //Converts char* to windows wchar_t*
+ BASICS_EXPORT wchar_t* ConvertToWideChar(const char* multibytearray);
+ //Converts std::string to windows std::wstring
+ BASICS_EXPORT std::wstring ConvertToWideString(std::string multibytearray);
+#endif
}
INCLUDE_DIRECTORIES(
${HDF5_INCLUDE_DIRS}
${MPI_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../Basics
)
FILE(GLOB SalomeHDFPersist_SOURCES_C "${CMAKE_CURRENT_SOURCE_DIR}/HDF*.c")
ADD_DEFINITIONS(${HDF5_DEFINITIONS})
ADD_LIBRARY(SalomeHDFPersist ${SalomeHDFPersist_SOURCES})
-TARGET_LINK_LIBRARIES(SalomeHDFPersist ${HDF5_LIBRARIES} ${MPI_LIBRARIES} ${PLATFORM_LIBS})
+SET(SalomeHDFPersist_libraries ${HDF5_LIBRARIES} ${MPI_LIBRARIES} ${PLATFORM_LIBS})
+IF(WIN32)
+ SET(SalomeHDFPersist_libraries ${SalomeHDFPersist_libraries} SALOMEBasics)
+ENDIF()
+TARGET_LINK_LIBRARIES(SalomeHDFPersist ${SalomeHDFPersist_libraries})
+
INSTALL(TARGETS SalomeHDFPersist EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
#include <string>
#ifdef WIN32
+#include <Basics_Utils.hxx>
#include <io.h>
#include <time.h>
#include <windows.h>
//============================================================================
bool HDFascii::isASCII(const char* thePath) {
int fd;
- if(!(fd = open(thePath, O_RDONLY))) return false;
+#ifdef WIN32
+ wchar_t* wstr = Kernel_Utils::ConvertToWideChar(thePath);
+ if(!(fd = _wopen(wstr, O_RDONLY))) {
+ delete wstr;
+ return false;
+ }
+ delete wstr;
+#else
+ if(!(fd = open(thePath, O_RDONLY))) return false;
+#endif
char* aBuffer = new char[9];
aBuffer[8] = (char)0;
read(fd, aBuffer, 8);
if(buffer[aLen-1] == '\n') buffer[aLen-1] = char(0);
#ifdef WIN32
aCmd = "move /Y \"" + aStudyTmpDir + std::string(buffer) + "\" \"" + SALOMEDSImpl_Tool::GetDirFromPath(aStudyUrl) +"\"";
+ std::wstring wstr = Kernel_Utils::ConvertToWideString(aCmd);
+ errors = _wsystem(wstr.c_str());
#else
aCmd = "mv -f \"" + aStudyTmpDir + std::string(buffer) + "\" \"" + SALOMEDSImpl_Tool::GetDirFromPath(aStudyUrl)+"\"";
+ errors = system(aCmd.c_str());
#endif
- errors = system(aCmd.c_str());
}
-
delete []buffer;
fclose(fp);
//Returns a name of the user
static std::string GetUserName();
-
};
#endif