AdPlug: Plugin now loads its AdPlug database on startup
This commit is contained in:
parent
322d9539d6
commit
6684a8280f
1 changed files with 23 additions and 0 deletions
|
@ -18,6 +18,29 @@
|
||||||
|
|
||||||
@implementation AdPlugDecoder
|
@implementation AdPlugDecoder
|
||||||
|
|
||||||
|
static CAdPlugDatabase * g_database = NULL;
|
||||||
|
|
||||||
|
+ (void)initialize
|
||||||
|
{
|
||||||
|
if (!g_database) {
|
||||||
|
CFURLRef appUrlRef = CFBundleCopyResourceURL(CFBundleGetBundleWithIdentifier(CFSTR("net.kode54.AdPlug")), CFSTR("adplug"), CFSTR("db"), NULL);
|
||||||
|
|
||||||
|
CFStringRef macPath = CFURLCopyFileSystemPath(appUrlRef, kCFURLPOSIXPathStyle);
|
||||||
|
|
||||||
|
NSString *dbPath = (__bridge NSString *) macPath;
|
||||||
|
|
||||||
|
if (dbPath) {
|
||||||
|
g_database = new CAdPlugDatabase;
|
||||||
|
g_database->load([dbPath UTF8String]);
|
||||||
|
|
||||||
|
CAdPlug::set_database( g_database );
|
||||||
|
|
||||||
|
CFRelease(macPath);
|
||||||
|
CFRelease(appUrlRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (id)init
|
- (id)init
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
Loading…
Reference in a new issue