Commit 769a08cf authored by adachan@apple.com's avatar adachan@apple.com
Browse files

https://bugs.webkit.org/show_bug.cgi?id=38555

        
Reviewed by David Kilzer.

Small code refactoring: move the logic to figure out the path to the 
databases directory to another method.

* Storage/WebDatabaseManager.mm:
(databasesDirectoryPath):
(WebKitInitializeDatabasesIfNecessary):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58787 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b3750a40
2010-05-04 Ada Chan <adachan@apple.com>
Reviewed by David Kilzer.
https://bugs.webkit.org/show_bug.cgi?id=38555
Small code refactoring: move the logic to figure out the path to the
databases directory to another method.
* Storage/WebDatabaseManager.mm:
(databasesDirectoryPath):
(WebKitInitializeDatabasesIfNecessary):
2010-05-04 Beth Dakin <bdakin@apple.com>
Reviewed by Mike Thole.
......
......@@ -49,6 +49,8 @@ NSString *WebDatabaseDidModifyOriginNotification = @"WebDatabaseDidModifyOriginN
NSString *WebDatabaseDidModifyDatabaseNotification = @"WebDatabaseDidModifyDatabaseNotification";
NSString *WebDatabaseIdentifierKey = @"WebDatabaseIdentifierKey";
static NSString *databasesDirectoryPath();
@implementation WebDatabaseManager
+ (WebDatabaseManager *) sharedWebDatabaseManager
......@@ -119,6 +121,16 @@ NSString *WebDatabaseIdentifierKey = @"WebDatabaseIdentifierKey";
@end
static NSString *databasesDirectoryPath()
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *databasesDirectory = [defaults objectForKey:WebDatabaseDirectoryDefaultsKey];
if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]])
databasesDirectory = @"~/Library/WebKit/Databases";
return [databasesDirectory stringByStandardizingPath];
}
void WebKitInitializeDatabasesIfNecessary()
{
static BOOL initialized = NO;
......@@ -126,13 +138,7 @@ void WebKitInitializeDatabasesIfNecessary()
return;
// Set the database root path in WebCore
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *databasesDirectory = [defaults objectForKey:WebDatabaseDirectoryDefaultsKey];
if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]])
databasesDirectory = @"~/Library/WebKit/Databases";
DatabaseTracker::tracker().setDatabaseDirectoryPath([databasesDirectory stringByStandardizingPath]);
DatabaseTracker::tracker().setDatabaseDirectoryPath(databasesDirectoryPath());
// Set the DatabaseTrackerClient
DatabaseTracker::tracker().setClient(WebDatabaseTrackerClient::sharedWebDatabaseTrackerClient());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment