Fix file dialog on windows
This commit is contained in:
parent
b9939ba10e
commit
9a5206ebf9
1 changed files with 7 additions and 4 deletions
|
|
@ -110,6 +110,7 @@ namespace psemek::ui
|
||||||
|
|
||||||
std::string escape(std::string str)
|
std::string escape(std::string str)
|
||||||
{
|
{
|
||||||
|
str = replace(std::move(str), "\\", "\\\\");
|
||||||
str = replace(std::move(str), "[", "\\[");
|
str = replace(std::move(str), "[", "\\[");
|
||||||
str = replace(std::move(str), "]", "\\]");
|
str = replace(std::move(str), "]", "\\]");
|
||||||
return str;
|
return str;
|
||||||
|
|
@ -233,10 +234,12 @@ namespace psemek::ui
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (auto const & component : new_path)
|
for (auto const & component : new_path)
|
||||||
{
|
{
|
||||||
if (component.string() != "/")
|
if (!new_path.root_name().empty() && component == new_path.root_directory())
|
||||||
path_str += "[link:" + util::to_string(++index) + "]" + escape(component.string()) + "[/link]/";
|
continue;
|
||||||
else
|
|
||||||
path_str += "[link:" + util::to_string(++index) + "]" + escape(component.string()) + "[/link]";
|
path_str += "[link:" + util::to_string(++index) + "]" + escape(component.string()) + "[/link]";
|
||||||
|
if (!new_path.root_name().empty() || component != new_path.root_directory())
|
||||||
|
path_str += escape(std::string(1, char(std::filesystem::path::preferred_separator)));
|
||||||
}
|
}
|
||||||
current_path_label->set_tagged_text(std::move(path_str));
|
current_path_label->set_tagged_text(std::move(path_str));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue