summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-06-18 15:01:32 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2011-06-18 15:01:32 -0700
commit96ed699dbb7d7c81c7cc8f245d561d1b91cb96df (patch)
tree9a7d561b7de3e74aa560bf2fd8abd32f232f8cd8
parenteb40eacacfbea2f8001470355f68e7aae481b991 (diff)
Refactor stash check to support complexity.
-rw-r--r--MobileCydia.mm28
1 files changed, 16 insertions, 12 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index a21a213..3e46875 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -10188,18 +10188,7 @@ _trace();
[window_ makeKey:self];
[window_ setHidden:NO];
- if (
- readlink("/Applications", NULL, 0) == -1 && errno == EINVAL ||
- readlink("/Library/Ringtones", NULL, 0) == -1 && errno == EINVAL ||
- readlink("/Library/Wallpaper", NULL, 0) == -1 && errno == EINVAL ||
- //readlink("/usr/bin", NULL, 0) == -1 && errno == EINVAL ||
- readlink("/usr/include", NULL, 0) == -1 && errno == EINVAL ||
- readlink("/usr/lib/pam", NULL, 0) == -1 && errno == EINVAL ||
- readlink("/usr/libexec", NULL, 0) == -1 && errno == EINVAL ||
- readlink("/usr/share", NULL, 0) == -1 && errno == EINVAL ||
- //readlink("/var/lib", NULL, 0) == -1 && errno == EINVAL ||
- false
- ) {
+ if (false) stash: {
[self addStashController];
// XXX: this would be much cleaner as a yieldToSelector:
// that way the removeStashController could happen right here inline
@@ -10208,6 +10197,21 @@ _trace();
return;
}
+ #define Stash_(path) do { \
+ if (readlink((path), NULL, 0) == -1 && errno == EINVAL) \
+ goto stash; \
+ } while (false)
+
+ Stash_("/Applications");
+ Stash_("/Library/Ringtones");
+ Stash_("/Library/Wallpaper");
+ //Stash_("/usr/bin");
+ Stash_("/usr/include");
+ Stash_("/usr/lib/pam");
+ Stash_("/usr/libexec");
+ Stash_("/usr/share");
+ //Stash_("/var/lib");
+
database_ = [Database sharedInstance];
[database_ setDelegate:self];