diff --git a/Applications/QuickLookGenerator/src/generate.mm b/Applications/QuickLookGenerator/src/generate.mm index eb4a1229..927e60eb 100644 --- a/Applications/QuickLookGenerator/src/generate.mm +++ b/Applications/QuickLookGenerator/src/generate.mm @@ -15,8 +15,6 @@ OAK_EXTERN_C_BEGIN -static plist::dictionary_t prune_dictionary (plist::dictionary_t const& plist) { return plist; } - static void initialize (CFBundleRef generatorBundle) { static dispatch_once_t onceToken; @@ -35,7 +33,7 @@ static void initialize (CFBundleRef generatorBundle) paths.push_back(path::join(path, "Bundles")); plist::cache_t cache; - cache.load(path::join(path::home(), "Library/Caches/com.macromates.TextMate/BundlesIndex.plist"), &prune_dictionary); + cache.load(path::join(path::home(), "Library/Caches/com.macromates.TextMate/BundlesIndex.plist")); auto index = create_bundle_index(paths, cache); bundles::set_index(index.first, index.second); diff --git a/Frameworks/plist/src/fs_cache.cc b/Frameworks/plist/src/fs_cache.cc index 26ab568c..ef2bb208 100644 --- a/Frameworks/plist/src/fs_cache.cc +++ b/Frameworks/plist/src/fs_cache.cc @@ -23,13 +23,15 @@ static std::string read_link (std::string const& path) return NULL_STR; } +static plist::dictionary_t dictionary_identity_function (plist::dictionary_t const& plist) { return plist; } + namespace plist { int32_t const cache_t::kPropertyCacheFormatVersion = 2; void cache_t::load (std::string const& path, plist::dictionary_t (*prune_dictionary)(plist::dictionary_t const&)) { - _prune_dictionary = prune_dictionary; + _prune_dictionary = prune_dictionary ?: dictionary_identity_function; int32_t version; auto plist = plist::load(path); diff --git a/Frameworks/plist/src/fs_cache.h b/Frameworks/plist/src/fs_cache.h index ad8959ca..2148841e 100644 --- a/Frameworks/plist/src/fs_cache.h +++ b/Frameworks/plist/src/fs_cache.h @@ -8,7 +8,7 @@ namespace plist { struct PUBLIC cache_t { - void load (std::string const& path, plist::dictionary_t (*prune_dictionary)(plist::dictionary_t const&)); + void load (std::string const& path, plist::dictionary_t (*prune_dictionary)(plist::dictionary_t const&) = NULL); void save (std::string const& path) const; bool dirty () const { return _dirty; }