mirror of https://github.com/kiwix/libkiwix.git
+ small bug fix for windows
This commit is contained in:
parent
784f87e715
commit
73217d5e49
|
@ -31,13 +31,14 @@ bool isRelativePath(const string &path) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Warning: the relative path must be with slashes */
|
||||||
string computeAbsolutePath(const string path, 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 = path[path.length() - 1] == '/' ? path : path + "/";
|
string absolutePath = path[path.length() - 1] == separator[0] ? path : path + separator;
|
||||||
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