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
1 changed files with 4 additions and 3 deletions

View File

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