diff --git a/Tools/NativeHost/AppController.h b/Tools/NativeHost/AppController.h index 0e245965b..69e1d2358 100644 --- a/Tools/NativeHost/AppController.h +++ b/Tools/NativeHost/AppController.h @@ -31,6 +31,7 @@ extern NSString *SERVER_USER; NSURL * baseURL; } +- (void)configureLocalStorage; - (NSURL *)baseURL; - (void)startServer; diff --git a/Tools/NativeHost/AppController.m b/Tools/NativeHost/AppController.m index da1204bbd..4982fc619 100644 --- a/Tools/NativeHost/AppController.m +++ b/Tools/NativeHost/AppController.m @@ -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];