27 #include <glibmm/miscutils.h>
34 #include "ardour/utils.h"
45 find_session (
string str,
string& path,
string& snapshot,
bool& isnew)
55 if (stat (str.c_str(), &statbuf)) {
56 if (errno == ENOENT) {
72 if (S_ISDIR (statbuf.st_mode)) {
74 string::size_type slash = str.find_last_of (G_DIR_SEPARATOR);
76 if (slash == string::npos) {
84 if (stat (tmp.c_str(), &statbuf)) {
101 snapshot = str.substr (slash+1);
105 }
else if (S_ISREG (statbuf.st_mode)) {
107 string::size_type slash = str.find_last_of (G_DIR_SEPARATOR);
108 string::size_type suffix;
112 if (slash != string::npos) {
113 snapshot = str.substr (slash+1);
120 if (suffix == string::npos) {
127 snapshot = snapshot.substr (0, suffix);
129 if (slash == string::npos) {
137 if (getcwd (cwd,
sizeof (cwd)) == 0) {
138 error <<
string_compose (
_(
"cannot determine current working directory (%1)"), strerror (errno))
149 path = str.substr (0, slash);
165 string::size_type slash = str.find_last_of (G_DIR_SEPARATOR);
167 if (slash == string::npos) {
177 snapshot = str.substr (slash+1);
int find_session(string str, string &path, string &snapshot, bool &isnew)
LIBARDOUR_API std::string legalize_for_path(const std::string &str)
LIBPBD_API Transmitter error
std::ostream & endmsg(std::ostream &ostr)
LIBARDOUR_API const char *const statefile_suffix
std::string string_compose(const std::string &fmt, const T1 &o1)
LIBPBD_API std::string canonical_path(const std::string &path)