diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2019-05-19 17:29:26 -0700 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2019-05-19 17:29:26 -0700 |
commit | 0a49c9d7028bea50d6d73f313c286f608a84b71b (patch) | |
tree | cf64f1833040ff6a31084be5c67fd31d1e172bda | |
parent | 5735c325ca335a79f28d2e20b77629c6e1f0f080 (diff) |
Remove all broken hardcoded usage of Cache folder.
-rw-r--r-- | MobileCydia.mm | 24 | ||||
-rw-r--r-- | Sources.h | 5 | ||||
-rw-r--r-- | Sources.mm | 11 | ||||
-rw-r--r-- | postinst.mm | 2 |
4 files changed, 23 insertions, 19 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index 22c1272..4b82efb 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -230,10 +230,6 @@ NSString *Elision_; static NSString *Error_; static NSString *Warning_; -static NSString *Cache_; -#define Cache(file) \ - [NSString stringWithFormat:@"%@/%s", Cache_, file] - static void (*$SBSSetInterceptsMenuButtonForever)(bool); static NSData *(*$SBSCopyIconImagePNGDataForDisplayIdentifier)(NSString *); @@ -680,8 +676,8 @@ static CFLocaleRef Locale_; static NSArray *Languages_; static CGColorSpaceRef space_; -#define CacheState_ "/var/mobile/Library/Caches/com.saurik.Cydia/CacheState.plist" -#define SavedState_ "/var/mobile/Library/Caches/com.saurik.Cydia/SavedState.plist" +#define CacheState_ Cache("CacheState.plist") +#define SavedState_ Cache("SavedState.plist") static NSDictionary *SectionMap_; static _H<NSDate> Backgrounded_; @@ -3631,7 +3627,7 @@ class CydiaLogCleaner : closedir(sources); } - error |= [self popErrorWithTitle:title forOperation:list.ReadAppend(SOURCES_LIST)]; + error |= [self popErrorWithTitle:title forOperation:list.ReadAppend([SOURCES_LIST UTF8String])]; return error; } @@ -4087,7 +4083,7 @@ class CydiaLogCleaner : [[NSDictionary dictionaryWithObjectsAndKeys: [NSDate date], @"LastUpdate", - nil] writeToFile:@ CacheState_ atomically:YES]; + nil] writeToFile:CacheState_ atomically:YES]; } [delegate_ performSelectorOnMainThread:@selector(releaseNetworkActivityIndicator) withObject:nil waitUntilDone:YES]; @@ -8270,7 +8266,7 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi - (void) _refreshIfPossible { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSDate *update([[NSDictionary dictionaryWithContentsOfFile:@ CacheState_] objectForKey:@"LastUpdate"]); + NSDate *update([[NSDictionary dictionaryWithContentsOfFile:CacheState_] objectForKey:@"LastUpdate"]); bool recently = false; if (update != nil) { @@ -8861,7 +8857,7 @@ _end @"InterfaceState", [tabbar_ navigationURLCollection], @"LastClosed", [NSDate date], @"InterfaceIndex", [NSNumber numberWithInt:[tabbar_ selectedIndex]], - nil] writeToFile:@ SavedState_ atomically:YES]; + nil] writeToFile:SavedState_ atomically:YES]; [self _saveConfig]; } @@ -9070,7 +9066,7 @@ _trace(); [self refreshIfPossible]; [self disemulate]; - NSDictionary *state([NSDictionary dictionaryWithContentsOfFile:@ SavedState_]); + NSDictionary *state([NSDictionary dictionaryWithContentsOfFile:SavedState_]); int savedIndex = [[state objectForKey:@"InterfaceIndex"] intValue]; NSArray *saved = [[[state objectForKey:@"InterfaceState"] mutableCopy] autorelease]; @@ -9417,9 +9413,9 @@ int main(int argc, char *argv[]) { Version_ = [NSNumber numberWithUnsignedInt:1]; - if (NSMutableDictionary *cache = [NSMutableDictionary dictionaryWithContentsOfFile:@ CacheState_]) { + if (NSMutableDictionary *cache = [NSMutableDictionary dictionaryWithContentsOfFile:CacheState_]) { [cache removeObjectForKey:@"LastUpdate"]; - [cache writeToFile:@ CacheState_ atomically:YES]; + [cache writeToFile:CacheState_ atomically:YES]; } } @@ -9456,7 +9452,7 @@ int main(int argc, char *argv[]) { _assert(errno == ENOENT); } - system("/usr/libexec/cydia/cydo /bin/ln -sf /var/mobile/Library/Caches/com.saurik.Cydia/sources.list /etc/apt/sources.list.d/cydia.list"); + system([[NSString stringWithFormat:@"/usr/libexec/cydia/cydo /bin/ln -sf %@ /etc/apt/sources.list.d/cydia.list", Cache("sources.list")] UTF8String]); /* APT Initialization {{{ */ _assert(pkgInitConfig(*_config)); @@ -28,6 +28,9 @@ void CydiaWriteSources(); void CydiaAddSource(NSDictionary *source); void CydiaAddSource(NSString *href, NSString *distribution, NSArray *sections = nil); -#define SOURCES_LIST "/var/mobile/Library/Caches/com.saurik.Cydia/sources.list" +extern NSString *Cache_; +NSString *Cache(const char *file); + +#define SOURCES_LIST Cache("sources.list") #endif//Sources_H @@ -28,11 +28,18 @@ #include "Sources.h" +NSString *Cache_; + +NSString *Cache(const char *file) { + return [NSString stringWithFormat:@"%@/%s", Cache_, file]; +} + extern _H<NSMutableDictionary> Sources_; void CydiaWriteSources() { - unlink(SOURCES_LIST); - FILE *file(fopen(SOURCES_LIST, "w")); + auto sources([SOURCES_LIST UTF8String]); + unlink(sources); + FILE *file(fopen(sources, "w")); _assert(file != NULL); fprintf(file, "deb http://apt.saurik.com/ ios/%.2f main\n", kCFCoreFoundationVersionNumber); diff --git a/postinst.mm b/postinst.mm index f826f4f..3cd8cdf 100644 --- a/postinst.mm +++ b/postinst.mm @@ -3,8 +3,6 @@ #include <dirent.h> #include <strings.h> -#include <Sources.h> - #include <sys/stat.h> #include <sys/sysctl.h> #include <sys/types.h> |