Do less syscalls in mkpath
authorMikko Rasa <tdb@tdb.fi>
Sun, 15 Jul 2012 12:05:32 +0000 (15:05 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 15 Jul 2012 12:05:32 +0000 (15:05 +0300)
source/fs/dir.cpp

index ea0cd952b5a77ad159d625664f6d0ed8991900d4..f7f34f668492383087c78ddb4f2627a4e551e38e 100644 (file)
@@ -84,9 +84,9 @@ void mkpath(const Path &path, int mode)
                if(p.size()==1 && p.is_absolute())
                        continue;
 #endif
                if(p.size()==1 && p.is_absolute())
                        continue;
 #endif
-               if(exists(p))
+               if(FS::Stat st = stat(p))
                {
                {
-                       if(!is_dir(p))
+                       if(!st.is_directory())
                                throw not_a_directory(p);
                        continue;
                }
                                throw not_a_directory(p);
                        continue;
                }