Frederic: this patch to sg_path.cxx will filter out false alarms when directory already exists.
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user