Salome HOME
Some corrections related to using UNICODE.
[modules/smesh.git] / src / MEDWrapper / MED_Factory.cxx
index 51fe44ce3f79263b688e5b8713381086a9ccebde..3e354c131c4e8cdea033cc7b44c1b608773ccab5 100644 (file)
@@ -37,12 +37,29 @@ extern "C"
 }
 #include <utilities.h>
 
+#ifdef WIN32
+#include <windows.h>
+#endif
+
+
 namespace MED
 {
   bool exists(const std::string& fileName)
   {
 #ifdef WIN32
-    return (GetFileAttributes(xmlPath.c_str()) != INVALID_FILE_ATTRIBUTES);
+#ifdef UNICODE
+       size_t length = strlen(fileName.c_str()) + sizeof(char);
+       wchar_t* path = new wchar_t[length];
+       memset(path, '\0', length);
+       mbstowcs(path, fileName.c_str(), length);
+#else
+       cosnt char* path = xmlPath.c_str();
+#endif
+       bool res = (GetFileAttributes(path) != INVALID_FILE_ATTRIBUTES);
+#ifdef UNICODE
+       delete path;
+#endif
+       return res;
 #else
     return (access(fileName.c_str(), F_OK) == 0);
 #endif