From 6490c82e7989f61e3cffda8646d3f1a094ef23f5 Mon Sep 17 00:00:00 2001 From: Karl Blomster Date: Sun, 27 Sep 2009 00:32:19 +0000 Subject: [PATCH] Change the way ffms2 index cache files are named to use source filename (without path) + source file's size in bytes + source file modification time, instead of just source file path + size in bytes, in order to make reusing index cache files on other computers easier. Closes #1008. Originally committed to SVN as r3582. --- aegisub/src/ffmpegsource_common.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/aegisub/src/ffmpegsource_common.cpp b/aegisub/src/ffmpegsource_common.cpp index b5a332ac8..b2fb3acf6 100644 --- a/aegisub/src/ffmpegsource_common.cpp +++ b/aegisub/src/ffmpegsource_common.cpp @@ -203,17 +203,20 @@ void FFmpegSourceProvider::SetLogLevel() { /// @brief Generates an unique name for the ffms2 index file and prepares the cache folder if it doesn't exist /// @param filename The name of the source file /// @return Returns the generated filename. -wxString FFmpegSourceProvider::GetCacheFilename(const wxString& filename) +wxString FFmpegSourceProvider::GetCacheFilename(const wxString& _filename) { // Get the size of the file to be hashed wxFileOffset len = 0; { - wxFile file(filename,wxFile::read); + wxFile file(_filename,wxFile::read); if (file.IsOpened()) len = file.Length(); } + wxFileName filename(_filename); + // Generate string to be hashed - wxString toHash = filename + wxString::Format(_T(":%i"),len); + wxString toHash = filename.GetFullName() + wxString::Format(_T(":%i"),len) + + wxString::Format(_T(":%i"), filename.GetModificationTime().GetTicks()); // Get the MD5 digest of the string const wchar_t *tmp = toHash.wc_str();