summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MobileCydia.mm24
-rw-r--r--Sources.h5
-rw-r--r--Sources.mm11
-rw-r--r--postinst.mm2
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));
diff --git a/Sources.h b/Sources.h
index 2defaf6..c3de58a 100644
--- a/Sources.h
+++ b/Sources.h
@@ -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
diff --git a/Sources.mm b/Sources.mm
index a156ee2..418ea08 100644
--- a/Sources.mm
+++ b/Sources.mm
@@ -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>