From c17fbd5abc315a0e44cd9b33d1210fab70cfb562 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 1 Feb 2022 15:43:06 +0100 Subject: [PATCH] Fix poor_mans_glob, `~' for `$HOME' is only valid at the start of a path --- libs/pbd/strreplace.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/pbd/strreplace.cc b/libs/pbd/strreplace.cc index 2ac8c9cb87..2f4767dec8 100644 --- a/libs/pbd/strreplace.cc +++ b/libs/pbd/strreplace.cc @@ -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; }