1
0
Fork 0

Bug fix/one more place to do preceding dir char wrong (#10150)

* make sure we don't build paths that start with two \'s

* fix condition
This commit is contained in:
Wilfried Goesgens 2019-10-02 21:55:30 +02:00 committed by KVS85
parent 823640e8f7
commit 1bbdea4dd4
1 changed files with 8 additions and 2 deletions

View File

@ -128,7 +128,10 @@ std::string buildFilename(char const* path, char const* name) {
std::string result(path);
if (!result.empty()) {
result = removeTrailingSeparator(result) + TRI_DIR_SEPARATOR_CHAR;
result = removeTrailingSeparator(result);
if (result.length() != 1 || result[0] != TRI_DIR_SEPARATOR_CHAR) {
result += TRI_DIR_SEPARATOR_CHAR;
}
}
if (!result.empty() && *name == TRI_DIR_SEPARATOR_CHAR) {
@ -147,7 +150,10 @@ std::string buildFilename(std::string const& path, std::string const& name) {
std::string result(path);
if (!result.empty()) {
result = removeTrailingSeparator(result) + TRI_DIR_SEPARATOR_CHAR;
result = removeTrailingSeparator(result);
if (result.length() != 1 || result[0] != TRI_DIR_SEPARATOR_CHAR) {
result += TRI_DIR_SEPARATOR_CHAR;
}
}
if (!result.empty() && !name.empty() && name[0] == TRI_DIR_SEPARATOR_CHAR) {