mirror of https://github.com/kiwix/libkiwix.git
+ fix bug in path computation in computeAbsolutePath()
This commit is contained in:
parent
9d371f295c
commit
cfa00c33f2
|
@ -63,9 +63,9 @@ namespace kiwix {
|
||||||
|
|
||||||
/* Compute absolute paths if relative one are used */
|
/* Compute absolute paths if relative one are used */
|
||||||
book.pathAbsolute = isRelativePath(book.path) ?
|
book.pathAbsolute = isRelativePath(book.path) ?
|
||||||
computeAbsolutePath(libraryPath, book.path) : book.path;
|
computeAbsolutePath(removeLastPathElement(libraryPath, true, false), book.path) : book.path;
|
||||||
book.indexPathAbsolute = isRelativePath(book.indexPath) ?
|
book.indexPathAbsolute = isRelativePath(book.indexPath) ?
|
||||||
computeAbsolutePath(libraryPath, book.indexPath) : book.indexPath;
|
computeAbsolutePath(removeLastPathElement(libraryPath, true, false), book.indexPath) : book.indexPath;
|
||||||
|
|
||||||
/* Update the book properties with the new importer */
|
/* Update the book properties with the new importer */
|
||||||
if (libraryVersion.empty() || atoi(libraryVersion.c_str()) < atoi(KIWIX_LIBRARY_VERSION)) {
|
if (libraryVersion.empty() || atoi(libraryVersion.c_str()) < atoi(KIWIX_LIBRARY_VERSION)) {
|
||||||
|
|
|
@ -27,13 +27,13 @@ bool isRelativePath(const string &path) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
string computeAbsolutePath(const string libraryPath, const string relativePath) {
|
string computeAbsolutePath(const string path, const string relativePath) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
string separator = "\\";
|
string separator = "\\";
|
||||||
#else
|
#else
|
||||||
string separator = "/";
|
string separator = "/";
|
||||||
#endif
|
#endif
|
||||||
string absolutePath = removeLastPathElement(libraryPath, true, false);
|
string absolutePath = path;
|
||||||
char *cRelativePath = strdup(relativePath.c_str());
|
char *cRelativePath = strdup(relativePath.c_str());
|
||||||
char *token = strtok(cRelativePath, "/");
|
char *token = strtok(cRelativePath, "/");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue