only normalize during append when necessary

master
Daniel Kolesa 2018-04-15 15:17:49 +02:00
parent 7cf307f60a
commit 9cea53491d
1 changed files with 5 additions and 3 deletions

View File

@ -331,7 +331,7 @@ struct path {
}
path &append(path const &p) {
append_str(p.p_path);
append_str(p.p_path, path_fmt(p.p_fmt) == path_fmt(p_fmt));
return *this;
}
@ -457,11 +457,13 @@ private:
}
}
void append_str(std::string s) {
void append_str(std::string s, bool norm = false) {
char sep = separator();
bool win = is_win();
/* replace multiple separator sequences and . parts */
cleanup_str(s, sep, win);
if (!norm) {
cleanup_str(s, sep, win);
}
/* if the path has a root, replace the previous path, otherwise
* append a separator followed by the path and be done with it
*