Created
April 1, 2012 21:35
-
-
Save n00neimp0rtant/2278942 to your computer and use it in GitHub Desktop.
user installed app directories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static NSString* pathForUserApplicationWithIdentifier(NSString* bundleIdentifier) | |
{ | |
NSFileManager* manager = [[[NSFileManager alloc] init] autorelease]; | |
NSArray* paths = [manager subpathsOfDirectoryAtPath:@"/var/mobile/Applications" error:nil]; | |
for(NSString* path in paths) | |
{ | |
NSDictionary* metadata = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"%@/iTunesMetadata.plist]]; | |
NSString* candidateID = [metadata objectForKey:@"softareVersionBundleId"]; | |
if([candidateID isEqualToString:bundleIdentifier]) | |
return path; | |
} | |
return nil; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment