From 60a9213035d3c9b8e17686778c70d91aa6acd356 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 7 Feb 2014 13:38:15 -0500 Subject: [PATCH] fix utter confusion about session _path in new sessions. Yikes! --- libs/ardour/session_state.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 1728c11244..6d535b8e59 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -136,13 +136,21 @@ Session::pre_engine_init (string fullpath) /* discover canonical fullpath */ char buf[PATH_MAX+1]; - if (!realpath (fullpath.c_str(), buf) && (errno != ENOENT)) { - error << string_compose(_("Could not use path %1 (%2)"), buf, strerror(errno)) << endmsg; - destroy (); - throw failed_constructor(); - } - _path = string(buf); + if (!realpath (fullpath.c_str(), buf)) { + if (errno == ENOENT) { + /* fullpath does not exist yet, so realpath() returned + * ENOENT. Just use it as-is + */ + _path = fullpath; + } else { + error << string_compose(_("Could not use path %1 (%2)"), buf, strerror(errno)) << endmsg; + destroy (); + throw failed_constructor(); + } + } else { + _path = string(buf); + } /* we require _path to end with a dir separator */