summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2012-03-07 00:02:46 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2012-03-07 00:02:46 -0800
commit29cbf4e5ccad23c2c58093345e64c9a1454dbafa (patch)
tree0a2556670058a7cdcc1703e958282429e167add9
parent76fb4bac75db0388e8e171ce8562dc1fdd6e6976 (diff)
Use our caches folder to store WebKit LocalStorage.
-rw-r--r--MobileCydia.mm15
1 files changed, 15 insertions, 0 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 6f26c87..904fb16 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -10482,6 +10482,14 @@ static CGSize $WAKWindow$screenSize(WAKWindow *self, SEL _cmd) {
return size;
}
+Class $NSUserDefaults;
+
+MSHook(id, NSUserDefaults$objectForKey$, NSUserDefaults *self, SEL _cmd, NSString *key) {
+ if ([key respondsToSelector:@selector(isEqualToString:)] && [key isEqualToString:@"WebKitLocalStorageDatabasePathPreferenceKey"])
+ return [NSString stringWithFormat:@"%@/LocalStorage", Cache_];
+ return _NSUserDefaults$objectForKey$(self, _cmd, key);
+}
+
int main(int argc, char *argv[]) {
NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
@@ -10573,6 +10581,13 @@ int main(int argc, char *argv[]) {
_NSURLConnection$init$ = reinterpret_cast<id (*)(NSURLConnection *, SEL, NSURLRequest *, id, BOOL, int64_t, BOOL, NSDictionary *)>(method_getImplementation(NSURLConnection$init$));
method_setImplementation(NSURLConnection$init$, reinterpret_cast<IMP>(&$NSURLConnection$init$));
}
+
+ $NSUserDefaults = objc_getClass("NSUserDefaults");
+ Method NSUserDefaults$objectForKey$(class_getInstanceMethod($NSUserDefaults, @selector(objectForKey:)));
+ if (NSUserDefaults$objectForKey$ != NULL) {
+ _NSUserDefaults$objectForKey$ = reinterpret_cast<id (*)(NSUserDefaults *, SEL, NSString *)>(method_getImplementation(NSUserDefaults$objectForKey$));
+ method_setImplementation(NSUserDefaults$objectForKey$, reinterpret_cast<IMP>(&$NSUserDefaults$objectForKey$));
+ }
/* }}} */
/* Set Locale {{{ */
Locale_ = CFLocaleCopyCurrent();