Frederic: this patch to sg_path.cxx will filter out false alarms when directory already exists.

This commit is contained in:
ehofman
2005-12-18 09:37:37 +00:00
parent 2e329426ab
commit bedbe3caad
+5 -1
View File
@@ -221,9 +221,13 @@ void SGPath::create_dir( mode_t mode ) {
} }
#endif #endif
struct stat info; struct stat info;
for(; stat( dir.c_str(), &info ) == 0 && i < path_elements.size(); i++) { int r;
for(; ( r = stat( dir.c_str(), &info ) ) == 0 && i < path_elements.size(); i++) {
dir.append(path_elements[i]); dir.append(path_elements[i]);
} }
if ( r == 0 ) {
return; // Directory already exists
}
if ( sgMkDir( dir.c_str(), mode) ) { if ( sgMkDir( dir.c_str(), mode) ) {
SG_LOG( SG_IO, SG_ALERT, "Error creating directory: " + dir.str() ); SG_LOG( SG_IO, SG_ALERT, "Error creating directory: " + dir.str() );
return; return;