Fix ticket #10388, an occasional failure of temp_directory_path to deal correctly with the trailing separator. A path member function remove_trailing_separator() was added publicly since this may be useful to users.

This commit is contained in:
Beman
2015-01-10 09:31:44 -05:00
parent a9561f945f
commit c0b5754ab8
3 changed files with 11 additions and 4 deletions

View File

@@ -254,6 +254,13 @@ namespace filesystem
return *this;
}
path& path::remove_trailing_separator()
{
if (!m_pathname.empty() && is_separator(m_pathname[m_pathname.size() - 1]))
m_pathname.erase(m_pathname.size() - 1);
return *this;
}
path& path::replace_extension(const path& new_extension)
{
// erase existing extension, including the dot, if any