summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2017-02-15 14:11:39 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2017-02-15 14:11:39 -0800
commit018ea8acbdde7f5ee5d68c7431f9f514dcb27714 (patch)
treec5c0059bbeeccb504f9fd3553ae3014f5967639c
parentbb347c4c58cfcd72dd17be9eeb2fcb8c813140b9 (diff)
Do not rely on specific filenames in source cells.
-rw-r--r--MobileCydia.mm14
1 files changed, 7 insertions, 7 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index a10181d..a948174 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -1194,7 +1194,10 @@ class SourceStatus :
}
//printf("Set(%s, %s)\n", fetch ? "true" : "false", uri.c_str());
- [database_ setFetch:fetch forURI:uri.c_str()];
+
+ auto slash(uri.rfind('/'));
+ if (slash != std::string::npos)
+ [database_ setFetch:fetch forURI:uri.substr(0, slash).c_str()];
}
_finline void Set(bool fetch, pkgAcquire::Item *item) {
@@ -1659,13 +1662,10 @@ static void SaveConfig(NSObject *lock) {
_profile(Source$setMetaIndex$DescURI)
for (pkgAcquire::ItemIterator item(acquire.ItemsBegin()); item != acquire.ItemsEnd(); item++) {
std::string file((*item)->DescURI());
- files_.insert(file);
- if (file.length() < sizeof("Packages.bz2") || file.substr(file.length() - sizeof("Packages.bz2")) != "/Packages.bz2")
+ auto slash(file.rfind('/'));
+ if (slash == std::string::npos)
continue;
- file = file.substr(0, file.length() - 4);
- files_.insert(file);
- files_.insert(file + ".gz");
- files_.insert(file + "Index");
+ files_.insert(file.substr(0, slash));
}
_end