diff options
author | Stijn Buys <ingar@osirion.org> | 2008-09-18 17:35:58 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-09-18 17:35:58 +0000 |
commit | 84a53f91e64ad801703bcf2c73a82b75ff10d760 (patch) | |
tree | bc187f6586d9527e3d6cd6d01b36036bd12f9695 /src/sys | |
parent | b6fcc157dad58d4fab32e01ea161acf20ab434a1 (diff) |
fix win32 build and directory creation, use My Games\
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/sys.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/sys/sys.cc b/src/sys/sys.cc index 3aec456..db2be4d 100644 --- a/src/sys/sys.cc +++ b/src/sys/sys.cc @@ -10,6 +10,7 @@ #include <windows.h> #include <sys/types.h> #include <sys/stat.h> +#include <direct.h> #else @@ -22,6 +23,7 @@ #endif +#include <stdio.h> #include <stdlib.h> #include <string> @@ -62,12 +64,15 @@ bool isdirectory(std::string const &path) void mkdir(std::string const &path) { #ifdef _WIN32 -/* std::string p(path); for (size_t i = 0; i < p.size(); i++) if (p[i] == '/') p[i] = '\\'; - mkdir(p.c_str()); -*/ + if (p.size() && (p[p.size()-1] == '\\')) + p.erase(p.size() -1, 1); + + if (_mkdir(p.c_str()) != 0) { + con_warn << "Could not create directory '" << p << "'" << std::endl; + } #else ::mkdir(path.c_str(), 0777); |