From: ehofman Date: Sun, 18 Dec 2005 09:37:37 +0000 (+0000) Subject: Frederic: this patch to sg_path.cxx will filter out false alarms when directory alrea... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bedbe3caad680f2aeb0fc9bbabd95f8d55d49d06;p=simgear.git Frederic: this patch to sg_path.cxx will filter out false alarms when directory already exists. --- diff --git a/simgear/misc/sg_path.cxx b/simgear/misc/sg_path.cxx index 4f709d1c..a72175ab 100644 --- a/simgear/misc/sg_path.cxx +++ b/simgear/misc/sg_path.cxx @@ -221,9 +221,13 @@ void SGPath::create_dir( mode_t mode ) { } #endif 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]); } + if ( r == 0 ) { + return; // Directory already exists + } if ( sgMkDir( dir.c_str(), mode) ) { SG_LOG( SG_IO, SG_ALERT, "Error creating directory: " + dir.str() ); return;