Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-08-03 14:22:25 +0000
committerStijn Buys <ingar@osirion.org>2008-08-03 14:22:25 +0000
commitd53bff0e774a179186d69a05e529cc29209ba4e0 (patch)
tree0788ae3504404d2d28a156b5d1b2a29e3169aa72 /src/sys
parent38bfca98a4203130251b4848d1f4c0f0c3c28ff4 (diff)
stat is called _stat on win32
Diffstat (limited to 'src/sys')
-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)