]> git.mxchange.org Git - simgear.git/commitdiff
Fix directory creation: 'ds' remains the same while 'dir' gets updated so use 'dir...
authorErik Hofman <erik@ehofman.com>
Sat, 2 Jul 2016 09:06:36 +0000 (11:06 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 13 Aug 2016 08:21:16 +0000 (10:21 +0200)
simgear/misc/sg_path.cxx

index 1e6836c37548bfadd7a347a987e43d4345893fe5..bc0fc450d2632a3a693d425e1e9e7f98336ac58e 100644 (file)
@@ -580,19 +580,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 << ")" );