diff --git a/env_universal_common.cpp b/env_universal_common.cpp index fd188e8a3..6cfd0055e 100644 --- a/env_universal_common.cpp +++ b/env_universal_common.cpp @@ -67,7 +67,7 @@ static wcstring fishd_get_config(); static std::string get_variables_file_path(const std::string &dir, const std::string &identifier); -static wcstring default_vars_path() +static wcstring default_vars_path_uncached() { wcstring wdir = fishd_get_config(); const std::string dir = wcs2string(wdir); @@ -79,6 +79,12 @@ static wcstring default_vars_path() return str2wcstring(machine_id_path); } +static const wcstring &default_vars_path() +{ + static wcstring cached_result = default_vars_path_uncached(); + return cached_result; +} + /** Test if the message msg contains the command cmd */