From f4344c5c6a5708814ab496906654f572b5206458 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Sat, 2 Jul 2016 11:06:36 +0200 Subject: [PATCH] Fix directory creation: 'ds' remains the same while 'dir' gets updated so use 'dir' instead --- simgear/misc/sg_path.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/simgear/misc/sg_path.cxx b/simgear/misc/sg_path.cxx index efdf8438..e28af592 100644 --- a/simgear/misc/sg_path.cxx +++ b/simgear/misc/sg_path.cxx @@ -574,19 +574,20 @@ int SGPath::create_dir(mode_t mode) if ( ds.find(':') != string::npos && path_elements.size() >= 2 ) { dir.append( path_elements[1] ); i = 2; - ds = dir.local8BitStr(); + ds = dir.local8BitStr(); } #endif struct stat info; int r; - for(; (r = stat(ds.c_str(), &info)) == 0 && i < path_elements.size(); ++i) + for(; (r = stat(dir.c_str(), &info)) == 0 && i < path_elements.size(); ++i) { dir.append(path_elements[i]); +} if( r == 0 ) return 0; // Directory already exists for(;;) { - if( sgMkDir(ds.c_str(), mode) ) + if( sgMkDir(dir.c_str(), mode) ) { SG_LOG( SG_IO, SG_ALERT, "Error creating directory: (" << dir << ")" );