]> git.tdb.fi Git - libs/core.git/blobdiff - source/stat.cpp
Refactor the API
[libs/core.git] / source / stat.cpp
index 5a0ee45ba20fe92e029ad2aa5ab73d089fd3f71c..3bfae74c348dc2429b135efc189878514c56d518 100644 (file)
@@ -6,6 +6,9 @@ Distributed under the LGPL
 */
 
 #include <cerrno>
+#ifdef WIN32
+#include <io.h>
+#endif
 #include <msp/core/except.h>
 #include "path.h"
 #include "stat.h"
@@ -31,6 +34,14 @@ bool exists(const Path &path)
        return access(path.str().c_str(), F_OK)==0;
 }
 
+bool is_reg(const Path &path)
+{
+       struct stat st;
+       if(stat(path, st)==0)
+               return S_ISREG(st.st_mode);
+       return false;
+}
+
 bool is_dir(const Path &path)
 {
        struct stat st;