From 3481b4aa4db2d8af1c6d5820010acbed76323890 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 9 Dec 2022 23:50:23 +0100 Subject: Use clean cache for first sync after cache format update --- src/plugins/Matrix.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 11eca06..fca4332 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -1681,7 +1681,7 @@ namespace QuickMedia { std::ifstream sync_cache_file_stream; sync_cache_file_stream.open(matrix_cache_dir.data.c_str(), std::ifstream::in | std::ifstream::binary); - if(sync_cache_file_stream.good()) { + if(sync_cache_file_stream.good() && get_file_type(get_cache_dir().join("matrix").join("updated-cache-version")) == FileType::REGULAR) { rapidjson::Document doc; std::string line; while(std::getline(sync_cache_file_stream, line)) { @@ -1833,6 +1833,7 @@ namespace QuickMedia { json_data += '\n'; fwrite(json_data.data(), 1, json_data.size(), sync_cache_file); + file_overwrite(get_cache_dir().join("matrix").join("updated-cache-version"), "1"); // To make sure the cache format is up to date malloc_trim(0); } fclose(sync_cache_file); -- cgit v1.2.3