diff --git a/xctool/xctool/XCToolUtil.h b/xctool/xctool/XCToolUtil.h index 22cbb75d1..7056a83f6 100644 --- a/xctool/xctool/XCToolUtil.h +++ b/xctool/xctool/XCToolUtil.h @@ -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(); \ No newline at end of file diff --git a/xctool/xctool/XCToolUtil.m b/xctool/xctool/XCToolUtil.m index 6163f8f4a..ae2bba344 100644 --- a/xctool/xctool/XCToolUtil.m +++ b/xctool/xctool/XCToolUtil.m @@ -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); diff --git a/xctool/xctool/main.m b/xctool/xctool/main.m index 8f2200be7..40bc46f6b 100644 --- a/xctool/xctool/main.m +++ b/xctool/xctool/main.m @@ -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];