when creating new MIDI sources, be sure that we create a stub file on disk
These files will be removed at session close if they are still empty. Their existence prevents collisions across snapshots and likely some other wierdness that relied on file existence for various tests and conditions
This commit is contained in:
parent
eb0f353716
commit
fad71ce748
|
@ -82,17 +82,18 @@ SMFSource::SMFSource (Session& s, const string& path, Source::Flag flags)
|
|||
|
||||
_flags = Source::Flag (_flags | Empty);
|
||||
|
||||
/* file is not opened until write */
|
||||
|
||||
if (flags & Writable) {
|
||||
return;
|
||||
if (_flags & Writable) {
|
||||
if (open_for_write ()) {
|
||||
throw failed_constructor ();
|
||||
}
|
||||
/* no fd left open here */
|
||||
} else {
|
||||
if (open (_path)) {
|
||||
throw failed_constructor ();
|
||||
}
|
||||
_open = true;
|
||||
}
|
||||
|
||||
if (open (_path)) {
|
||||
throw failed_constructor ();
|
||||
}
|
||||
|
||||
_open = true;
|
||||
}
|
||||
|
||||
/** Constructor used for external-to-session files. File must exist. */
|
||||
|
@ -113,11 +114,6 @@ SMFSource::SMFSource (Session& s, const string& path)
|
|||
assert (Glib::file_test (_path, Glib::FILE_TEST_EXISTS));
|
||||
existence_check ();
|
||||
|
||||
if (_flags & Writable) {
|
||||
/* file is not opened until write */
|
||||
return;
|
||||
}
|
||||
|
||||
if (open (_path)) {
|
||||
throw failed_constructor ();
|
||||
}
|
||||
|
@ -172,17 +168,18 @@ SMFSource::SMFSource (Session& s, const XMLNode& node, bool must_exist)
|
|||
if (!(_flags & Source::Empty)) {
|
||||
assert (Glib::file_test (_path, Glib::FILE_TEST_EXISTS));
|
||||
existence_check ();
|
||||
if (open (_path)) {
|
||||
throw failed_constructor ();
|
||||
}
|
||||
_open = true;
|
||||
} else {
|
||||
assert (_flags & Source::Writable);
|
||||
/* file will be opened on write */
|
||||
return;
|
||||
if (open_for_write ()) {
|
||||
throw failed_constructor ();
|
||||
}
|
||||
/* no fd left open here */
|
||||
}
|
||||
|
||||
if (open (_path)) {
|
||||
throw failed_constructor ();
|
||||
}
|
||||
|
||||
_open = true;
|
||||
}
|
||||
|
||||
SMFSource::~SMFSource ()
|
||||
|
|
Loading…
Reference in New Issue
Block a user