13
0

Retain ctime/mtime when encoding file for archiving

This commit is contained in:
Robin Gareus 2022-11-27 14:10:53 +01:00
parent abf92e42c0
commit 03575011b5
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -37,6 +37,12 @@
#include <glib.h>
#include "pbd/gstdio_compat.h"
#ifdef COMPILER_MSVC
#include <sys/utime.h>
#else
#include <utime.h>
#endif
#include <glibmm/convert.h>
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
@ -312,6 +318,16 @@ SndFileSource::SndFileSource (Session& s, const AudioFileSource& other, const st
progress->set_progress (0.5f + 0.5f * (float) off / other.readable_length_samples ());
}
}
close ();
/* copy ctime */
GStatBuf statbuf;
if (g_stat (other.path().c_str(), &statbuf) == 0 && statbuf.st_size > 0) {
struct utimbuf tbuf;
tbuf.actime = statbuf.st_atime;
tbuf.modtime = statbuf.st_mtime; // = time ((time_t*) 0);
g_utime (path.c_str(), &tbuf);
}
}
void