-static bool
-template_filter (const string &str, void *arg)
-{
- return (str.length() > strlen(Session::template_suffix()) &&
- str.find (Session::template_suffix()) == (str.length() - strlen (Session::template_suffix())));
-}
-
-void
-Session::get_template_list (list<string> &template_names)
-{
- vector<string *> *templates;
- PathScanner scanner;
- string path;
-
- path = template_path ();
-
- templates = scanner (path, template_filter, 0, false, true);
-
- vector<string*>::iterator i;
- for (i = templates->begin(); i != templates->end(); ++i) {
- string fullpath = *(*i);
- int start, end;
-
- start = fullpath.find_last_of ('/') + 1;
- if ((end = fullpath.find_last_of ('.')) <0) {
- end = fullpath.length();
- }
-
- template_names.push_back(fullpath.substr(start, (end-start)));
- }
-}
-
-int
-Session::read_favorite_dirs (FavoriteDirs & favs)
-{
- string path = get_user_ardour_path();
- path += "/favorite_dirs";
-
- ifstream fav (path.c_str());
-
- favs.clear();
-
- if (!fav) {
- if (errno != ENOENT) {
- //error << string_compose (_("cannot open favorite file %1 (%2)"), path, strerror (errno)) << endmsg;
- return -1;
- } else {
- return 1;
- }
- }
-
- while (true) {
-
- string newfav;
-
- getline(fav, newfav);
-
- if (!fav.good()) {
- break;
- }
-
- favs.push_back (newfav);
- }
-
- return 0;
-}
-
-int
-Session::write_favorite_dirs (FavoriteDirs & favs)
-{
- string path = get_user_ardour_path();
- path += "/favorite_dirs";
-
- ofstream fav (path.c_str());
-
- if (!fav) {
- return -1;
- }
-
- for (FavoriteDirs::iterator i = favs.begin(); i != favs.end(); ++i) {
- fav << (*i) << endl;
- }
-
- return 0;
-}
-