Make universal variables cache the path to the variable file

This commit is contained in:
ridiculousfish 2014-11-09 16:55:02 -08:00
parent 32c0afe5a9
commit 330e996c30

View file

@ -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
*/