Reset source paths on session rename (fixes #4389).
git-svn-id: svn://localhost/ardour2/branches/3.0@10299 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
b507805bf6
commit
8404d7ff94
@ -28,8 +28,6 @@
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <cerrno>
|
||||
|
||||
|
||||
#include <cstdio> /* snprintf(3) ... grrr */
|
||||
#include <cmath>
|
||||
#include <unistd.h>
|
||||
@ -53,6 +51,8 @@
|
||||
#include <glibmm.h>
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "midi++/mmc.h"
|
||||
#include "midi++/port.h"
|
||||
#include "midi++/manager.h"
|
||||
@ -3670,6 +3670,8 @@ Session::rename (const std::string& new_name)
|
||||
string newstr;
|
||||
bool first = true;
|
||||
|
||||
string const old_sources_root = _session_dir->sources_root().to_string ();
|
||||
|
||||
#define RENAME ::rename
|
||||
|
||||
/* Rename:
|
||||
@ -3791,6 +3793,17 @@ Session::rename (const std::string& new_name)
|
||||
}
|
||||
}
|
||||
|
||||
/* update file source paths */
|
||||
|
||||
for (SourceMap::iterator i = sources.begin(); i != sources.end(); ++i) {
|
||||
boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource> (i->second);
|
||||
if (fs) {
|
||||
string p = fs->path ();
|
||||
boost::replace_all (p, old_sources_root, _session_dir->sources_root().to_string ());
|
||||
fs->set_path (p);
|
||||
}
|
||||
}
|
||||
|
||||
/* remove old name from recent sessions */
|
||||
|
||||
remove_recent_sessions (_path);
|
||||
|
Loading…
Reference in New Issue
Block a user