summaryrefslogtreecommitdiff
path: root/libs/ardour/session_state.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r--libs/ardour/session_state.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 5098f5d62b..b44b42294c 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -44,6 +44,10 @@
#include <climits>
#include <signal.h>
#include <sys/time.h>
+/* for open(2) */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
@@ -80,6 +84,7 @@
#include "pbd/file_utils.h"
#include "pbd/pathexpand.h"
#include "pbd/pthread_utils.h"
+#include "pbd/scoped_file_descriptor.h"
#include "pbd/stacktrace.h"
#include "pbd/types_convert.h"
#include "pbd/localtime_r.h"
@@ -154,6 +159,8 @@ using namespace PBD;
#define DEBUG_UNDO_HISTORY(msg) DEBUG_TRACE (PBD::DEBUG::UndoHistory, string_compose ("%1: %2\n", __LINE__, msg));
+static const char* unnamed_file_name = X_(".unnamed");
+
void
Session::pre_engine_init (string fullpath)
{
@@ -569,13 +576,17 @@ Session::ensure_subdirs ()
* Caller must not hold process lock.
*/
int
-Session::create (const string& session_template, BusProfile const * bus_profile)
+Session::create (const string& session_template, BusProfile const * bus_profile, bool unnamed)
{
if (g_mkdir_with_parents (_path.c_str(), 0755) < 0) {
error << string_compose(_("Session: cannot create session folder \"%1\" (%2)"), _path, strerror (errno)) << endmsg;
return -1;
}
+ if (unnamed) {
+ PBD::ScopedFileDescriptor fd = g_open (Glib::build_filename (_path, unnamed_file_name).c_str(), O_CREAT|O_TRUNC|O_RDWR, 0666);
+ }
+
if (ensure_subdirs ()) {
return -1;
}
@@ -5637,3 +5648,9 @@ Session::redo (uint32_t n)
StateProtector stp (this);
_history.redo (n);
}
+
+bool
+Session::not_named() const
+{
+ return Glib::file_test (Glib::build_filename (_path, unnamed_file_name), Glib::FILE_TEST_EXISTS);
+}