#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
+#include "pbd/file_utils.h"
#include "pbd/scoped_file_descriptor.h"
#include "pbd/xml++.h"
_peakpath = construct_peak_filepath (audio_path);
- DEBUG_TRACE(DEBUG::Peaks, string_compose ("Initialize Peakfile %1 for Audio file %2\n", _peakpath, audio_path));
-
- /* if the peak file should be there, but isn't .... */
-
if (!empty() && !Glib::file_test (_peakpath.c_str(), Glib::FILE_TEST_EXISTS)) {
- _peakpath = find_broken_peakfile (_peakpath, audio_path);
+ string oldpeak = construct_peak_filepath (audio_path, true);
+ DEBUG_TRACE(DEBUG::Peaks, string_compose ("Looking for old peak file %1 for Audio file %2\n", oldpeak, audio_path));
+ if (Glib::file_test (oldpeak.c_str(), Glib::FILE_TEST_EXISTS)) {
+ // TODO use hard-link if possible
+ DEBUG_TRACE(DEBUG::Peaks, string_compose ("Copy old peakfile %1 to %2\n", oldpeak, _peakpath));
+ PBD::copy_file (oldpeak, _peakpath);
+ }
}
+ DEBUG_TRACE(DEBUG::Peaks, string_compose ("Initialize Peakfile %1 for Audio file %2\n", _peakpath, audio_path));
+
if (g_stat (_peakpath.c_str(), &statbuf)) {
if (errno != ENOENT) {
/* it exists in the peaks dir, but there is some kind of error */