From f0fd87bf66213350e48902f7dbace486c9935739 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Sun, 17 Mar 2013 16:03:11 +0100 Subject: [PATCH] Only use cache file if at version 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since it’s not unlikely that a user will downgrade from a nightly build, we should be prepared to see cache files using a newer (incompatible) file format. --- Frameworks/bundles/src/io.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Frameworks/bundles/src/io.cc b/Frameworks/bundles/src/io.cc index 09b2e30d3e..b56eafb739 100644 --- a/Frameworks/bundles/src/io.cc +++ b/Frameworks/bundles/src/io.cc @@ -55,6 +55,10 @@ namespace bundles property_cache_t (std::string const& cacheFile) : _cache_file(cacheFile), _dirty(false) { _cache = plist::load(_cache_file); + + int32_t version; + if(!plist::get_key_path(_cache, "version", version) || version != 1) + _cache = plist::dictionary_t(); } ~property_cache_t () @@ -70,7 +74,10 @@ namespace bundles } if(_dirty) + { + _cache["version"] = 1; plist::save(_cache_file, _cache); + } } plist::dictionary_t const& get (std::string const& path, time_t modified)