Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Commit

Permalink
fix problem where xctool would crash when run from a sym link.
Browse files Browse the repository at this point in the history
Sigh... I broke this again.
  • Loading branch information
fpotter committed Aug 27, 2013
1 parent a30d5ce commit 9c0f68e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion xctool/xctool/XCToolUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ NSArray *AvailableReporters();
*/
NSString *AbsolutePathFromRelative(NSString *path);

/**
Returns the absolute path to the current executable, with sym links resolved.
*/
NSString *AbsoluteExecutablePath();

/**
* Returns the contents of `/etc/paths` in the form of `path1:path2:path3`.
*/
NSString *SystemPaths();
NSString *SystemPaths();
2 changes: 1 addition & 1 deletion xctool/xctool/XCToolUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
return settings;
}

static NSString *AbsoluteExecutablePath(void) {
NSString *AbsoluteExecutablePath() {
char execRelativePath[PATH_MAX] = {0};
uint32_t execRelativePathSize = sizeof(execRelativePath);
_NSGetExecutablePath(execRelativePath, &execRelativePathSize);
Expand Down
2 changes: 1 addition & 1 deletion xctool/xctool/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int main(int argc, const char * argv[])
// Don't do this setup again...
setenv("XT_DID_SET_DYLD_FALLBACK_FRAMEWORK_PATH", "YES", 1);

execv(argv[0], (char *const *)argv);
execv([AbsoluteExecutablePath() UTF8String], (char *const *)argv);
}

NSArray *arguments = [[NSProcessInfo processInfo] arguments];
Expand Down

0 comments on commit 9c0f68e

Please sign in to comment.