mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Make dictionary map function optional for cache_t::load
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user