diff options
author | dec05eba <dec05eba@protonmail.com> | 2017-12-30 04:32:49 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2017-12-30 05:08:10 +0100 |
commit | 98ad7dd049a366e21d60a34548736a3c8ef72877 (patch) | |
tree | 45e34eb02f6be9f9130a870a19ef1533e24bf343 /src/Conf.cpp | |
parent | 1f583ebb6e3973c992d59886659bf53ff87f41de (diff) |
Add support for windows (ugly fast solution)
Diffstat (limited to 'src/Conf.cpp')
-rw-r--r-- | src/Conf.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/Conf.cpp b/src/Conf.cpp index d6aee2c..743942a 100644 --- a/src/Conf.cpp +++ b/src/Conf.cpp @@ -1,5 +1,5 @@ #include "../include/Conf.hpp" -#include "../include/FileUtil.hpp" +#include "../include/types.hpp" #include "../external/utf8/unchecked.h" using namespace std; @@ -7,8 +7,6 @@ using u8string = utf8::unchecked::iterator<char*>; namespace sibs { - u32 min(u32 a, u32 b) { return a < b ? a : b; } - class UnexpectedTokenException : public std::runtime_error { public: @@ -316,7 +314,7 @@ namespace sibs bool objectDefined; }; - Result<bool> Config::readFromFile(const char *filepath, const ConfigCallback &callback) + Result<bool> Config::readFromFile(const _tinydir_char_t *filepath, const ConfigCallback &callback) { Result<StringView> fileContentResult = getFileContent(filepath); if(fileContentResult.isErr()) @@ -409,9 +407,13 @@ namespace sibs if (value.isSingle()) { testPath = projectPath; - testPath += "/"; - testPath += string(value.asSingle().data, value.asSingle().size); - Result<string> testRealPathResult = getRealPath(testPath.c_str()); + testPath += TINYDIR_STRING("/"); +#if OS_FAMILY == OS_FAMILY_POSIX + testPath += FileString(value.asSingle().data, value.asSingle().size); +#else + testPath += utf8To16(value.asSingle()); +#endif + Result<FileString> testRealPathResult = getRealPath(testPath.c_str()); if(!testRealPathResult) { string errMsg = "Failed to resolve package.tests path: "; |