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 *);
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_;
closedir(sources);
}
- error |= [self popErrorWithTitle:title forOperation:list.ReadAppend(SOURCES_LIST)];
+ error |= [self popErrorWithTitle:title forOperation:list.ReadAppend([SOURCES_LIST UTF8String])];
return error;
}
[[NSDictionary dictionaryWithObjectsAndKeys:
[NSDate date], @"LastUpdate",
- nil] writeToFile:@ CacheState_ atomically:YES];
+ nil] writeToFile:CacheState_ atomically:YES];
}
[delegate_ performSelectorOnMainThread:@selector(releaseNetworkActivityIndicator) withObject:nil waitUntilDone:YES];
- (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) {
@"InterfaceState", [tabbar_ navigationURLCollection],
@"LastClosed", [NSDate date],
@"InterfaceIndex", [NSNumber numberWithInt:[tabbar_ selectedIndex]],
- nil] writeToFile:@ SavedState_ atomically:YES];
+ nil] writeToFile:SavedState_ atomically:YES];
[self _saveConfig];
}
[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];
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];
}
}
_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));
#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);