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