Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys/sys.cc')
-rw-r--r--src/sys/sys.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/sys/sys.cc b/src/sys/sys.cc
index 9526166..3aec456 100644
--- a/src/sys/sys.cc
+++ b/src/sys/sys.cc
@@ -8,6 +8,8 @@
#ifdef _WIN32
#include <windows.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#else
@@ -15,8 +17,8 @@
#include <signal.h>
#include <string.h>
#include <sys/time.h>
-#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/stat.h>
#endif
@@ -29,16 +31,32 @@ namespace sys {
bool isdirectory(std::string const &path)
{
+#ifdef _WIN32
+ struct ::_stat path_stat;
+ memset(&path_stat, 0, sizeof(struct ::_stat));
+
+ if (::_stat(path.c_str(), &path_stat) != 0) {
+ return false;
+ }
+
+ if (path_stat.st_mode & _S_IFDIR) {
+ return true;
+ }
+ return false;
+#else
struct stat path_stat;
memset(&path_stat, 0, sizeof(path_stat));
- if (stat(path.c_str(), &path_stat) != 0)
+
+ if (stat(path.c_str(), &path_stat) != 0) {
return false;
+ }
if (path_stat.st_mode & S_IFDIR) {
return true;
}
return false;
+#endif
}
void mkdir(std::string const &path)