diff options
author | elfmz <fenix1905@tut.by> | 2021-10-17 01:04:49 +0300 |
---|---|---|
committer | elfmz <fenix1905@tut.by> | 2021-10-17 01:04:49 +0300 |
commit | 43cdf3226133c49260bf18640a77ce30b48a4886 (patch) | |
tree | 2809c7450be64b989b1d80a13eb6d209e7819233 /utils | |
parent | b997ccabb62d21a5298089ff1d8e4dabd3319cb9 (diff) |
NetRocks/SCP: some fixes with file times etc (fix #1107)
Diffstat (limited to 'utils')
-rw-r--r-- | utils/include/utils.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/include/utils.h b/utils/include/utils.h index d5e76624..8441d6a3 100644 --- a/utils/include/utils.h +++ b/utils/include/utils.h @@ -151,6 +151,16 @@ template <class CharT> } template <class CharT> + std::basic_string<CharT> EnsureNoSlashAtNestedEnd(std::basic_string<CharT> str, CharT slash = '/') +{ + for (size_t p = str.size(); p > 1 && str[p - 1] == slash; ) { + str.resize(--p); + } + return str; +} + + +template <class CharT> std::basic_string<CharT> EnsureSlashAtEnd(std::basic_string<CharT> str, CharT slash = '/') { const size_t p = str.size(); |