From 330e996c30f2f3f6e812e79f5b28f16bb1b7d04e Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 9 Nov 2014 16:55:02 -0800 Subject: [PATCH] Make universal variables cache the path to the variable file --- env_universal_common.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 */