mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-10 00:52:11 +01:00
Handle 2 edge cases in the new helpers.
This commit is contained in:
parent
059d6751d5
commit
5b31a47a21
@ -1044,11 +1044,18 @@ void String::append_path(const String &path) {
|
||||
}
|
||||
|
||||
void String::path_clean_end_slash() {
|
||||
while (ends_with('/') || ends_with('\\')) {
|
||||
// _size > 1, so if root is given ("/"), it will not be removed
|
||||
|
||||
while (_size > 1 && (ends_with('/') || ends_with('\\'))) {
|
||||
pop_back();
|
||||
}
|
||||
}
|
||||
void String::path_ensure_end_slash() {
|
||||
//Don't add if empty string, as it would make it root on linux, which can easily become a serious bug
|
||||
if (_size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(ends_with('/') || ends_with('\\'))) {
|
||||
push_back(DEFAULT_DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user