From 96ed699dbb7d7c81c7cc8f245d561d1b91cb96df Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 18 Jun 2011 15:01:32 -0700 Subject: Refactor stash check to support complexity. --- MobileCydia.mm | 28 ++++++++++++++++------------ 1 file 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]; -- cgit v1.2.3