move export_search_path(), previously in gtk2_ardour/main.cc, into libs/pbd
This commit is contained in:
parent
b8419ae7cd
commit
8040df1897
@ -110,6 +110,9 @@ protected:
|
||||
void add_directories (const std::vector<std::string>& paths);
|
||||
};
|
||||
|
||||
void export_search_path (const std::string& base_dir, const char* varname, const char* dir);
|
||||
|
||||
|
||||
} // namespace PBD
|
||||
|
||||
#endif /* __libpbd_search_path_h__ */
|
||||
|
@ -17,6 +17,9 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glibmm/miscutils.h>
|
||||
|
||||
#include "pbd/tokenizer.h"
|
||||
@ -118,4 +121,26 @@ Searchpath::add_subdirectory_to_paths (const string& subdir)
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* 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 += ':';
|
||||
} else {
|
||||
path = "";
|
||||
}
|
||||
path += base_dir;
|
||||
path += dir;
|
||||
|
||||
g_setenv (varname, path.c_str(), 1);
|
||||
}
|
||||
|
||||
} // namespace PBD
|
||||
|
Loading…
Reference in New Issue
Block a user