diff options
author | dec05eba <dec05eba@protonmail.com> | 2017-12-31 05:24:40 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2017-12-31 05:26:07 +0100 |
commit | 017ec45e94204f977dcd7b04c8035d48f230ded3 (patch) | |
tree | 7778ecc069f05fb527329f36876ed13a17a48ab3 /src/FileUtil.cpp | |
parent | 7a5910121ab0ad2ea8a4a60e5b6599b7255e5a5e (diff) |
Sibs can now build itself on windows
Fixed several bugs.
The windows implementation IS QUICK AND DIRTY! It links
things as static even if you wish to link as dynamic etc.....
NEED TO FIX THIS !!!
Diffstat (limited to 'src/FileUtil.cpp')
-rw-r--r-- | src/FileUtil.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/FileUtil.cpp b/src/FileUtil.cpp index 5cf8377..db68bb4 100644 --- a/src/FileUtil.cpp +++ b/src/FileUtil.cpp @@ -68,6 +68,16 @@ namespace sibs LocalFree(messageBuffer); return message; } + + void replaceChar(FileString &input, wchar_t charToReplace, wchar_t charToReplaceWith) + { + for (int i = 0; i < input.size(); ++i) + { + wchar_t c = input[i]; + if (c == charToReplace) + input[i] = charToReplaceWith; + } + } #endif #if OS_FAMILY == OS_FAMILY_POSIX @@ -100,7 +110,7 @@ namespace sibs { tinydir_file file; tinydir_readfile(&dir, &file); - if(_tinydir_strcmp(file.name, TINYDIR_STRING(".")) != 0 && _tinydir_strcmp(file.name, TINYDIR_STRING("..")) != 0) + if(_tinydir_strncmp(file.name, TINYDIR_STRING("."), 1) != 0) callbackFunc(&file); tinydir_next(&dir); } @@ -138,7 +148,7 @@ namespace sibs tinydir_readfile(&dir, &file); if(file.is_reg) callbackFunc(&file); - else if(_tinydir_strcmp(file.name, TINYDIR_STRING(".")) != 0 && _tinydir_strcmp(file.name, TINYDIR_STRING("..")) != 0) + else if(_tinydir_strncmp(file.name, TINYDIR_STRING("."), 1) != 0) walkDirFilesRecursive(file.path, callbackFunc); tinydir_next(&dir); } |