From d4ecda40ff8553bc583eb52b140c06f685f10ec9 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Sat, 3 Nov 2018 10:37:52 +0100 Subject: [PATCH 1/2] Use the correct separator when computing relativePath. --- src/common/pathTools.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/common/pathTools.cpp b/src/common/pathTools.cpp index cb76475e1..198dd3272 100644 --- a/src/common/pathTools.cpp +++ b/src/common/pathTools.cpp @@ -35,9 +35,9 @@ #endif #ifdef _WIN32 -#define SEPARATOR "\\" +const std::string SEPARATOR("\\"); #else -#define SEPARATOR "/" +const std::string SEPARATOR("/"); #include #endif @@ -66,9 +66,7 @@ string computeRelativePath(const string path, const string absolutePath) while (commonCount < pathParts.size() && commonCount < absolutePathParts.size() && pathParts[commonCount] == absolutePathParts[commonCount]) { - if (!pathParts[commonCount].empty()) { commonCount++; - } } string relativePath; @@ -76,18 +74,17 @@ string computeRelativePath(const string path, const string absolutePath) /* On Windows you have a token more because the root is represented by a letter */ if (commonCount == 0) { - relativePath = "../"; + relativePath = ".." + SEPARATOR; } #endif for (unsigned int i = commonCount; i < pathParts.size(); i++) { - relativePath += "../"; + relativePath += ".." + SEPARATOR; } for (unsigned int i = commonCount; i < absolutePathParts.size(); i++) { relativePath += absolutePathParts[i]; - relativePath += i + 1 < absolutePathParts.size() ? "/" : ""; + relativePath += i + 1 < absolutePathParts.size() ? SEPARATOR : ""; } - return relativePath; } From 57d3552b9722d7f4c81125485d0643cdc2b392af Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Sat, 3 Nov 2018 12:20:13 +0100 Subject: [PATCH 2/2] New version 3.0.2 --- ChangeLog | 5 +++++ meson.build | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 17afe53e4..11fd581b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +kiwix-lib 3.0.2 +=============== + + * Use the correct path separator when computing relativePath on Windows. + kiwix-lib 3.0.1 =============== diff --git a/meson.build b/meson.build index f696cccaa..400f7250f 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('kiwix-lib', 'cpp', - version : '3.0.1', + version : '3.0.2', license : 'GPL', default_options : ['c_std=c11', 'cpp_std=c++11', 'werror=true'])