diff options
author | dec05eba <dec05eba@protonmail.com> | 2017-12-31 06:17:54 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2017-12-31 06:19:50 +0100 |
commit | ab712cf153e543e84a5c6484e19d22ba90bdbeff (patch) | |
tree | b82b101b586deb6caca63a1de8737a89e82bd4f5 /src/FileUtil.cpp | |
parent | ae213b2b6f8dcc75de53ab27b0b35bc3455a8eb3 (diff) |
Add cmake building, add ignore dirs option
Sometimes it's not possible to build new sibs with older sibs because
of changes that break backwards compatbility.
If sibs installation fails with sibs, use cmake.
Diffstat (limited to 'src/FileUtil.cpp')
-rw-r--r-- | src/FileUtil.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/FileUtil.cpp b/src/FileUtil.cpp index db68bb4..e53aa85 100644 --- a/src/FileUtil.cpp +++ b/src/FileUtil.cpp @@ -308,8 +308,6 @@ namespace sibs } #else -#pragma comment(lib, "Userenv.lib") - Result<FileString> getHomeDir() { BOOL ret; @@ -410,4 +408,26 @@ namespace sibs return Result<FileString>::Ok(fullPath); } #endif -}
\ No newline at end of file + + // TODO: Support better path equality check. For example if path contains several slashes in a row: /home/userName/.sibs//lib////libraryName + // then it should equal: /home/userName/.sibs/lib/libraryName + // Maybe check with OS operation if they refer to the same inode? + bool pathEquals(const std::string &path, const std::string &otherPath) + { + if(path.size() != otherPath.size()) + return false; + + size_t size = path.size(); + for(size_t i = 0; i < size; ++i) + { + char c = path[i]; + char otherC = otherPath[i]; + if(c == '\\') c = '/'; + if(otherC == '\\') otherC = '/'; + if(c != otherC) + return false; + } + + return true; + } +} |