summaryrefslogtreecommitdiff
path: root/libs/ardour/session_state.cc
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2016-09-14 21:48:33 +1000
committerTim Mayberry <mojofunk@gmail.com>2016-09-15 21:27:55 +1000
commitff53fa9806d4359154e8eaa55cc320b77c6e73f5 (patch)
tree854e7d7adaba2743a4e10ca1596d4f7c9354fec2 /libs/ardour/session_state.cc
parent304b491a29430d3ef9f2e17d50e1f0e39d6abede (diff)
Send/show error message if g_stat fails in Session::cleanup_sources
let the user/developer know if this does occur rather than just silently skipping the file. Fix some whitespace issues while we are changing indentation.
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r--libs/ardour/session_state.cc51
1 files changed, 24 insertions, 27 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 5729c889bd..682e212ad1 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -3304,37 +3304,34 @@ Session::cleanup_sources (CleanupReport& rep)
}
- if (0 == g_stat ((*x).c_str(), &statbuf)) {
-
- if (::g_rename ((*x).c_str(), newpath.c_str()) != 0) {
- error << string_compose (_("cannot rename unused file source from %1 to %2 (%3)"), (*x), newpath, g_strerror (errno)) << endmsg;
- continue;
- }
+ if ((g_stat ((*x).c_str(), &statbuf) != 0) || (::g_rename ((*x).c_str(), newpath.c_str()) != 0)) {
+ error << string_compose (_("cannot rename unused file source from %1 to %2 (%3)"), (*x),
+ newpath, g_strerror (errno)) << endmsg;
+ continue;
+ }
- /* see if there an easy to find peakfile for this file, and remove it.
- */
+ /* see if there an easy to find peakfile for this file, and remove it.
+ */
- string base = Glib::path_get_basename (*x);
- base += "%A"; /* this is what we add for the channel suffix of all native files,
- or for the first channel of embedded files. it will miss
- some peakfiles for other channels
- */
- string peakpath = construct_peak_filepath (base);
-
- if (Glib::file_test (peakpath.c_str(), Glib::FILE_TEST_EXISTS)) {
- if (::g_unlink (peakpath.c_str()) != 0) {
- error << string_compose (_("cannot remove peakfile %1 for %2 (%3)"),
- peakpath, _path, g_strerror (errno))
- << endmsg;
- /* try to back out */
- ::g_rename (newpath.c_str(), _path.c_str());
- goto out;
- }
+ string base = Glib::path_get_basename (*x);
+ base += "%A"; /* this is what we add for the channel suffix of all native files,
+ or for the first channel of embedded files. it will miss
+ some peakfiles for other channels
+ */
+ string peakpath = construct_peak_filepath (base);
+
+ if (Glib::file_test (peakpath.c_str (), Glib::FILE_TEST_EXISTS)) {
+ if (::g_unlink (peakpath.c_str ()) != 0) {
+ error << string_compose (_("cannot remove peakfile %1 for %2 (%3)"), peakpath, _path,
+ g_strerror (errno)) << endmsg;
+ /* try to back out */
+ ::g_rename (newpath.c_str (), _path.c_str ());
+ goto out;
}
-
- rep.paths.push_back (*x);
- rep.space += statbuf.st_size;
}
+
+ rep.paths.push_back (*x);
+ rep.space += statbuf.st_size;
}
/* dump the history list */