diff options
author | dec05eba <dec05eba@protonmail.com> | 2017-12-30 05:33:25 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2017-12-30 05:33:25 +0100 |
commit | 7c215c39d530f01235043a131d64d4c7f766e9ab (patch) | |
tree | d72effe043a46566e34276525081637cad1bb7a0 /src/Conf.cpp | |
parent | abab2184ade33097f3441f8cdd95dd27c5653930 (diff) | |
parent | 98ad7dd049a366e21d60a34548736a3c8ef72877 (diff) |
Merge release_0.1.0 to master
Add support for windows
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 6d5834e..5282bb5 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()) @@ -430,9 +428,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: "; |