+bool
+Searchpath::contains (const string& path) const
+{
+ std::vector<std::string>::const_iterator i = find(begin(), end(), path);
+
+ if (i == end()) {
+ return false;
+ }
+ return true;
+}
+
+/* This is not part of the Searchpath object, but is closely related to the
+ * whole idea, and we put it here for convenience.
+ */
+
+void
+export_search_path (const string& base_dir, const char* varname, const char* dir)
+{
+ string path;
+ const char * cstr = g_getenv (varname);
+
+ if (cstr) {
+ path = cstr;
+ path += G_SEARCHPATH_SEPARATOR;
+ } else {
+ path = "";
+ }
+ path += base_dir;
+ path += dir;
+
+ g_setenv (varname, path.c_str(), 1);
+}
+