aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-12-09 23:50:23 +0100
committerdec05eba <dec05eba@protonmail.com>2022-12-09 23:50:23 +0100
commit3481b4aa4db2d8af1c6d5820010acbed76323890 (patch)
tree4728f7a31335c03b000fdfef00b0dd11c1134c5e
parent17f74130a93d5b5eb9fb33e453670e7247494104 (diff)
Use clean cache for first sync after cache format update
-rw-r--r--src/plugins/Matrix.cpp3
1 files changed, 2 insertions, 1 deletions
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);