mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Support for localstorage in NativeHost
This commit is contained in:
committed by
Randall Luecke
parent
65c48004ba
commit
e55cbbdc0e
@@ -31,6 +31,7 @@ extern NSString *SERVER_USER;
|
||||
NSURL * baseURL;
|
||||
}
|
||||
|
||||
- (void)configureLocalStorage;
|
||||
- (NSURL *)baseURL;
|
||||
|
||||
- (void)startServer;
|
||||
|
||||
@@ -176,6 +176,19 @@ NSString *SERVER_USER = nil;
|
||||
[server stop];
|
||||
}
|
||||
|
||||
- (void)configureLocalStorage
|
||||
{
|
||||
WebPreferences *webConfiguration = [WebPreferences standardPreferences];
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
NSString *saveFolder = [mainBundle objectForInfoDictionaryKey:@"CPBundleName"];
|
||||
NSString *applicationSupportFile = [@"~/Library/Application Support/" stringByExpandingTildeInPath];
|
||||
NSString *savePath = [NSString pathWithComponents:[NSArray arrayWithObjects:applicationSupportFile, saveFolder, nil]];
|
||||
NSLog(savePath);
|
||||
[webConfiguration _setLocalStorageDatabasePath:savePath];
|
||||
|
||||
[webView setPreferences:webConfiguration];
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
webView = [[WebView alloc] init];
|
||||
@@ -184,7 +197,9 @@ NSString *SERVER_USER = nil;
|
||||
[webView setFrameLoadDelegate:self];
|
||||
[webView setResourceLoadDelegate:self];
|
||||
[webView setPolicyDelegate:self];
|
||||
|
||||
|
||||
[self configureLocalStorage];
|
||||
|
||||
webViewWindow = [[NSWindow alloc] init];
|
||||
|
||||
[webViewWindow setContentView:webView];
|
||||
|
||||
Reference in New Issue
Block a user