From ab712cf153e543e84a5c6484e19d22ba90bdbeff Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 31 Dec 2017 06:17:54 +0100 Subject: 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. --- src/FileUtil.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src/FileUtil.cpp') 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 getHomeDir() { BOOL ret; @@ -410,4 +408,26 @@ namespace sibs return Result::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; + } +} -- cgit v1.2.3