13
0

Fix poor_mans_glob, ~' for $HOME' is only valid at the start of a path

This commit is contained in:
Robin Gareus 2022-02-01 15:43:06 +01:00
parent 6f04296635
commit c17fbd5abc
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -39,8 +39,9 @@ replace_all (std::string& str,
std::string std::string
poor_mans_glob (std::string path) poor_mans_glob (std::string path)
{ {
std::string copy = path; if (path.find ('~') == 0) {
replace_all (copy, "~", Glib::get_home_dir()); path.replace (0, 1, Glib::get_home_dir());
return copy; }
return path;
} }