From a3ec1644503ef0a3e83efc030033cf5665c15a87 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 29 Nov 2017 15:08:25 +0100 Subject: [PATCH] Set VST cache file mtime to be at least as new as the plugin Fixes issues with timezones when installing pluins from a .zip --- libs/ardour/vst_info_file.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libs/ardour/vst_info_file.cc b/libs/ardour/vst_info_file.cc index d58b7a94a5..df28cbc02e 100644 --- a/libs/ardour/vst_info_file.cc +++ b/libs/ardour/vst_info_file.cc @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -1078,6 +1079,19 @@ vstfx_get_info (const char* dllpath, enum ARDOUR::PluginType type, enum VSTScanM } else { vstfx_write_info_file (infofile, infos); fclose (infofile); + + /* In some cases the .dll may have a modification time in the future, + * (e.g. unzip a VST plugin: .zip files don't include timezones) + */ + string const fsipath = vstfx_infofile_path (dllpath); + GStatBuf dllstat; + GStatBuf fsistat; + if (g_stat (dllpath, &dllstat) == 0 && g_stat (fsipath.c_str (), &fsistat) == 0) { + struct utimbuf utb; + utb.actime = fsistat.st_atime; + utb.modtime = std::max (dllstat.st_mtime, fsistat.st_mtime); + g_utime (fsipath.c_str (), &utb); + } } return infos; }