const string &name = Application::get_name();
if(name.empty())
throw logic_error("application name not known");
- return get_user_data_dir();
+ return get_user_data_dir(name);
}
Path get_sys_conf_dir(const string &argv0)
throw system_error("chdir");
}
+Path path_lookup(const string &name, const list<Path> &paths)
+{
+ for(list<Path>::const_iterator i=paths.begin(); i!=paths.end(); ++i)
+ {
+ Path full = *i/name;
+ if(exists(full))
+ return realpath(full);
+ }
+
+ return Path();
+}
+
+Path path_lookup(const string &name)
+{
+ const char *path = getenv("PATH");
+ vector<string> dirs = split(path, ITEMSEP);
+ return path_lookup(name, list<Path>(dirs.begin(), dirs.end()));
+}
+
} // namespace FS
} // namespace Msp