summaryrefslogtreecommitdiff
path: root/libs/pbd
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-07-16 14:55:11 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-07-16 14:55:11 +0000
commitc8e3f32533cc6f4481222781d93e7bf7c32ffe5f (patch)
tree94f6c8a687459ebeaaa259acc4da1832ff2bd303 /libs/pbd
parente9ab577177db3c37719331c00900e48d4dfbf158 (diff)
newly created files for use in recording appear in a .stubs folder, and are moved out of it when recording stops
git-svn-id: svn://localhost/ardour2/branches/3.0@7426 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd')
-rw-r--r--libs/pbd/file_manager.cc21
-rw-r--r--libs/pbd/pbd/file_manager.h5
-rw-r--r--libs/pbd/sndfile_manager.cc2
-rw-r--r--libs/pbd/wscript1
4 files changed, 20 insertions, 9 deletions
diff --git a/libs/pbd/file_manager.cc b/libs/pbd/file_manager.cc
index 0f05ecedc4..4d82e3d112 100644
--- a/libs/pbd/file_manager.cc
+++ b/libs/pbd/file_manager.cc
@@ -100,19 +100,19 @@ FileManager::allocate (FileDescriptor* d)
DEBUG::FileManager,
string_compose (
"closed file for %1 to release file handle; now have %2 of %3 open\n",
- (*oldest)->_name, _open, _max_open
+ (*oldest)->_path, _open, _max_open
)
);
}
if (d->open ()) {
- DEBUG_TRACE (DEBUG::FileManager, string_compose ("open of %1 failed.\n", d->_name));
+ DEBUG_TRACE (DEBUG::FileManager, string_compose ("open of %1 failed.\n", d->_path));
return true;
}
_open++;
- DEBUG_TRACE (DEBUG::FileManager, string_compose ("opened file for %1; now have %2 of %3 open.\n", d->_name, _open, _max_open));
+ DEBUG_TRACE (DEBUG::FileManager, string_compose ("opened file for %1; now have %2 of %3 open.\n", d->_path, _open, _max_open));
}
#ifdef __APPLE__
@@ -148,7 +148,7 @@ FileManager::remove (FileDescriptor* d)
close (d);
DEBUG_TRACE (
DEBUG::FileManager,
- string_compose ("closed file for %1; file is being removed; now have %2 of %3 open\n", d->_name, _open, _max_open)
+ string_compose ("closed file for %1; file is being removed; now have %2 of %3 open\n", d->_path, _open, _max_open)
);
}
@@ -168,7 +168,7 @@ FileManager::close (FileDescriptor* d)
FileDescriptor::FileDescriptor (string const & n, bool w)
: _refcount (0)
, _last_used (0)
- , _name (n)
+ , _path (n)
, _writeable (w)
{
@@ -224,7 +224,7 @@ FdFileDescriptor::open ()
{
/* we must have a lock on the FileManager's mutex */
- _fd = ::open (_name.c_str(), _writeable ? (O_RDWR | O_CREAT) : O_RDONLY, _mode);
+ _fd = ::open (_path.c_str(), _writeable ? (O_RDWR | O_CREAT) : O_RDONLY, _mode);
return (_fd == -1);
}
@@ -253,6 +253,13 @@ FdFileDescriptor::allocate ()
}
+void
+FileDescriptor::set_path (const string& p)
+{
+ assert (!is_open());
+ _path = p;
+}
+
/** @param n Filename.
* @param w true to open writeable, otherwise false.
*/
@@ -283,7 +290,7 @@ StdioFileDescriptor::open ()
{
/* we must have a lock on the FileManager's mutex */
- _file = fopen (_name.c_str(), _mode.c_str());
+ _file = fopen (_path.c_str(), _mode.c_str());
return (_file == 0);
}
diff --git a/libs/pbd/pbd/file_manager.h b/libs/pbd/pbd/file_manager.h
index 2d3650c2c5..5d957eaa5a 100644
--- a/libs/pbd/pbd/file_manager.h
+++ b/libs/pbd/pbd/file_manager.h
@@ -51,7 +51,10 @@ public:
FileDescriptor (std::string const &, bool);
virtual ~FileDescriptor () {}
+ const std::string& path() const { return _path; }
+
void release ();
+ virtual void set_path (const std::string&);
/** Emitted when the file is closed */
PBD::Signal0<void> Closed;
@@ -71,7 +74,7 @@ protected:
int _refcount; ///< number of active users of this file
double _last_used; ///< monotonic time that this file was last allocated
- std::string _name; ///< filename
+ std::string _path; ///< file path
bool _writeable; ///< true if it should be opened writeable, otherwise false
FileManager* manager ();
diff --git a/libs/pbd/sndfile_manager.cc b/libs/pbd/sndfile_manager.cc
index 5637de26ee..c6a52416ed 100644
--- a/libs/pbd/sndfile_manager.cc
+++ b/libs/pbd/sndfile_manager.cc
@@ -86,7 +86,7 @@ SndFileDescriptor::open ()
{
/* we must have a lock on the FileManager's mutex */
- _sndfile = sf_open (_name.c_str(), _writeable ? SFM_RDWR : SFM_READ, _info);
+ _sndfile = sf_open (_path.c_str(), _writeable ? SFM_RDWR : SFM_READ, _info);
return (_sndfile == 0);
}
diff --git a/libs/pbd/wscript b/libs/pbd/wscript
index a558a04da2..275db6d70d 100644
--- a/libs/pbd/wscript
+++ b/libs/pbd/wscript
@@ -59,6 +59,7 @@ def build(bld):
convert.cc
controllable.cc
controllable_descriptor.cc
+ clear_dir.cc
crossthread.cc
cpus.cc
debug.cc