centralize legal-session-name-checkng and include : and ; in characters that we disallow, because they conflict with search path conventions on *nix and windows

git-svn-id: svn://localhost/ardour2/branches/3.0@10943 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2011-12-09 03:06:58 +00:00
parent 26366a4062
commit 86ac8536d2
3 changed files with 24 additions and 20 deletions

View File

@@ -238,6 +238,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
template<class T> void foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>));
template<class T, class A> void foreach_route (T *obj, void (T::*func)(Route&, A), A arg);
static char session_name_is_legal (const std::string&);
bool io_name_is_legal (const std::string&);
boost::shared_ptr<Route> route_by_name (std::string);
boost::shared_ptr<Route> route_by_id (PBD::ID);

View File

@@ -4543,3 +4543,16 @@ Session::update_latency_compensation (bool force_whole_graph)
}
}
char
Session::session_name_is_legal (const string& path)
{
char illegal_chars[] = { '/', '\\', ':', ';', '\0' };
for (int i = 0; illegal_chars[i]; ++i) {
if (path.find (illegal_chars[i]) != string::npos) {
return illegal_chars[i];
}
}
return 0;
}