Do less syscalls in mkpath
[libs/core.git] / 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(exists(p))
+               if(FS::Stat st = stat(p))
                {
-                       if(!is_dir(p))
+                       if(!st.is_directory())
                                throw not_a_directory(p);
                        continue;
                }