Permalink
Browse files

Fix use of relative application paths.

The iPhoneSimulatorRemoteClient API requires an absolute path to an
application. This change adds resolution of relative paths prior to
attempting to launch the app.
  • Loading branch information...
1 parent b07d35a commit 66a20a12deff7d43aa88bc369783af7ff5c9a12c @landonf committed Feb 4, 2010
Showing with 12 additions and 1 deletion.
  1. +12 −1 Source/iPhoneSimExample.m
View
@@ -200,8 +200,19 @@ - (void) runWithArgc: (int) argc argv: (char **) argv {
argc -= optind;
argv += optind;
+ /* Determine the absolute path */
+ char *absolute = realpath(argv[0], NULL);
+ NSString *appPath;
+ if (absolute == NULL) {
+ fprintf(stderr, "Could not determine absolute path for %s: %s", argv[0], strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ appPath = [NSString stringWithUTF8String: absolute];
+ free(absolute);
+
/* Don't exit, adds to runloop */
- [self launchApp: [NSString stringWithUTF8String: argv[0]] sdkVersion: sdkVersion simulatedDeviceFamily: simulatedDeviceFamily];
+ [self launchApp: appPath sdkVersion: sdkVersion simulatedDeviceFamily: simulatedDeviceFamily];
} else {
fprintf(stderr, "Unknown command\n");
[self printUsage];

0 comments on commit 66a20a1

Please sign in to comment.