16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 00:49:19 +02:00

return empty string_view in substr_path if no '/' was found

This commit is contained in:
docentYT
2026-05-01 18:38:28 +02:00
parent 0e6950a386
commit 0c19bd4507

View File

@@ -393,8 +393,9 @@ void replace_slashes(std::string &Filename)
// returns potential path part from provided file name
std::string_view substr_path(std::string const &Filename)
{
if (auto pos = Filename.rfind('/'); pos != std::string_view::npos)
if (auto pos = Filename.rfind('/'); pos != std::string::npos)
return Filename.substr(0, pos + 1);
return {};
}
// returns length of common prefix between two provided strings