Skip to content

Commit

Permalink
Use the MOBILE_APPLICATIONS_DIRECTORY environment variable if present
Browse files Browse the repository at this point in the history
  • Loading branch information
0xced committed Nov 29, 2013
1 parent b5644e6 commit c8e5ac2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Classes/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ - (void) applicationDidFinishLaunching:(UIApplication *)application
{
self.window.frame = [[UIScreen mainScreen] bounds];

NSString *mobileApplicationsPath = nil;
NSString *simulatorHostHome = NSProcessInfo.processInfo.environment[@"IPHONE_SIMULATOR_HOST_HOME"];
for (NSString *path in @[ @"Music/iTunes/Mobile Applications", @"Music/iTunes/iTunes Media/Mobile Applications" ])
NSString *mobileApplicationsPath = NSProcessInfo.processInfo.environment[@"MOBILE_APPLICATIONS_DIRECTORY"];
if (!mobileApplicationsPath)
{
NSString *fullPath = [simulatorHostHome stringByAppendingPathComponent:path];
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath])
mobileApplicationsPath = fullPath;
NSString *simulatorHostHome = NSProcessInfo.processInfo.environment[@"IPHONE_SIMULATOR_HOST_HOME"];
for (NSString *path in @[ @"Music/iTunes/Mobile Applications", @"Music/iTunes/iTunes Media/Mobile Applications" ])
{
NSString *fullPath = [simulatorHostHome stringByAppendingPathComponent:path];
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath])
mobileApplicationsPath = fullPath;
}
}
if (!mobileApplicationsPath)
NSLog(@"'Mobile Applications' directory not found.");
Expand Down

0 comments on commit c8e5ac2

Please sign in to comment.