Skip to content

Commit

Permalink
Only use cache file if at version 1
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sorbits committed Mar 17, 2013
1 parent 062f781 commit f0fd87b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Frameworks/bundles/src/io.cc
Expand Up @@ -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 ()
Expand All @@ -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)
Expand Down

0 comments on commit f0fd87b

Please sign in to comment.