Include trailing separators in section split

This fixes the case on Windows where one of the paths ends up consisting
only of a drive letter and no trailing slash - in which case Windows
treats it as "current directory on drive X" and not "root of drive X"
and GetFileAttributes throws an invalid param error
This commit is contained in:
Silent 2020-02-05 19:38:57 +01:00 committed by Ani
parent f8b3c48af7
commit fbbad7c851

View file

@ -238,7 +238,8 @@ namespace gui
{
// get Icon for the gs_frame from path. this handles presumably all possible use cases
const QString qpath = qstr(path);
const std::string path_list[] = { path, sstr(qpath.section("/", 0, -2)), sstr(qpath.section("/", 0, -3)) };
const std::string path_list[] = { path, sstr(qpath.section("/", 0, -2, QString::SectionIncludeTrailingSep)),
sstr(qpath.section("/", 0, -3, QString::SectionIncludeTrailingSep)) };
for (const std::string& pth : path_list)
{