Salome HOME
projects
/
modules
/
smesh.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
23076: [CEA 1499] Get in python all sub-shapes in error after Compute
[modules/smesh.git]
/
src
/
SMESHUtils
/
SMESH_File.cxx
diff --git
a/src/SMESHUtils/SMESH_File.cxx
b/src/SMESHUtils/SMESH_File.cxx
index ade3256bbe7c5a3d2d52e485b22452586c99416a..8d138b46cee114b2425be891aa87241073809f16 100644
(file)
--- a/
src/SMESHUtils/SMESH_File.cxx
+++ b/
src/SMESHUtils/SMESH_File.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-201
4
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-201
5
CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@
-45,7
+45,13
@@
namespace boofs = boost::filesystem;
//================================================================================
SMESH_File::SMESH_File(const std::string& name, bool open)
//================================================================================
SMESH_File::SMESH_File(const std::string& name, bool open)
- :_name(name), _size(-1), _file(0), _map(0), _pos(0), _end(0)
+ :_name(name), _size(-1),
+#ifdef WIN32
+ _file(INVALID_HANDLE_VALUE),
+#else
+ _file(-1),
+#endif
+ _map(0), _pos(0), _end(0)
{
if ( open ) this->open();
}
{
if ( open ) this->open();
}
@@
-105,6
+111,10
@@
bool SMESH_File::open()
#endif
}
}
#endif
}
}
+ else if ( _error.empty() )
+ {
+ _error = "Can't open for reading an existing file " + _name;
+ }
}
return _pos;
}
}
return _pos;
}
@@
-134,11
+144,15
@@
void SMESH_File::close()
else if ( _file >= 0 )
{
#ifdef WIN32
else if ( _file >= 0 )
{
#ifdef WIN32
- CloseHandle(_file);
- _file = INVALID_HANDLE_VALUE;
+ if(_file != INVALID_HANDLE_VALUE) {
+ CloseHandle(_file);
+ _file = INVALID_HANDLE_VALUE;
+ }
#else
#else
- ::close(_file);
- _file = -1;
+ if(_file != -1) {
+ ::close(_file);
+ _file = -1;
+ }
#endif
}
}
#endif
}
}