mirror of https://github.com/kiwix/libkiwix.git
+ small fix to avoid duplicate slashes in paths
This commit is contained in:
parent
5922808e12
commit
79d00c2b36
|
@ -33,7 +33,7 @@ string computeAbsolutePath(const string path, const string relativePath) {
|
||||||
#else
|
#else
|
||||||
string separator = "/";
|
string separator = "/";
|
||||||
#endif
|
#endif
|
||||||
string absolutePath = path + "/";
|
string absolutePath = path[path.length() - 1] == '/' ? path : path + "/";
|
||||||
char *cRelativePath = strdup(relativePath.c_str());
|
char *cRelativePath = strdup(relativePath.c_str());
|
||||||
char *token = strtok(cRelativePath, "/");
|
char *token = strtok(cRelativePath, "/");
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ string getLastPathElement(const string &path) {
|
||||||
string separator = "/";
|
string separator = "/";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return path.substr(path.find_last_of(separator));
|
return path.substr(path.find_last_of(separator) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int getFileSize(const string &path) {
|
unsigned int getFileSize(const string &path) {
|
||||||
|
|
Loading…
Reference in New Issue