X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHUtils%2FSMESH_File.cxx;h=2472d9eb3a365ee6bbcd772b4f42e2103886b18c;hp=556212201577637d642265fd613a4cc9ecde78b8;hb=c5f8cda9bf008812f728073dd5cc04f6c5082bbb;hpb=00bd895f4432dd67f39c9f4e5066bfdc2f337a24 diff --git a/src/SMESHUtils/SMESH_File.cxx b/src/SMESHUtils/SMESH_File.cxx index 556212201..2472d9eb3 100644 --- a/src/SMESHUtils/SMESH_File.cxx +++ b/src/SMESHUtils/SMESH_File.cxx @@ -36,6 +36,8 @@ #include +#include + namespace boofs = boost::filesystem; //================================================================================ @@ -79,9 +81,17 @@ bool SMESH_File::open() if ( !_map && length > 0 ) { #ifdef WIN32 - _file = CreateFile(_name.data(), GENERIC_READ, FILE_SHARE_READ, +#ifdef UNICODE + const wchar_t* name = Kernel_Utils::decode(_name.data()); +#else + char* name = name.data(); +#endif + _file = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); bool ok = ( _file != INVALID_HANDLE_VALUE ); +#ifdef UNICODE + delete name; +#endif #else _file = ::open(_name.data(), O_RDONLY ); bool ok = ( _file >= 0 ); @@ -291,14 +301,21 @@ bool SMESH_File::getInts(std::vector& ints) bool SMESH_File::openForWriting() { #ifdef WIN32 - - _file = CreateFile( _name.c_str(), // name of the write +#ifdef UNICODE + const wchar_t* name = Kernel_Utils::decode(_name.data()); +#else + char* name = name.data(); +#endif + _file = CreateFile( name, // name of the write GENERIC_WRITE, // open for writing 0, // do not share NULL, // default security OPEN_ALWAYS, // CREATE NEW or OPEN EXISTING FILE_ATTRIBUTE_NORMAL, // normal file NULL); // no attr. template +#ifdef UNICODE + delete name; +#endif return ( _file != INVALID_HANDLE_VALUE ); #else