|
@@ -53,26 +53,33 @@ void fixCwd() { |
|
|
if (isCorrectCwd()) |
|
|
if (isCorrectCwd()) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
// Get path of binary inside the app bundle |
|
|
// Get path of binary inside the app bundle |
|
|
// It should be something like */Rack.app/Contents/MacOS |
|
|
|
|
|
|
|
|
// It should be something like .../Rack.app/Contents/MacOS |
|
|
char path[PATH_MAX]; |
|
|
char path[PATH_MAX]; |
|
|
uint32_t pathLen = sizeof(path); |
|
|
uint32_t pathLen = sizeof(path); |
|
|
int err = _NSGetExecutablePath(path, &pathLen); |
|
|
int err = _NSGetExecutablePath(path, &pathLen); |
|
|
assert(!err); |
|
|
assert(!err); |
|
|
|
|
|
if (isCorrectCwd()) |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
// Switch to the directory of the actual binary |
|
|
// Switch to the directory of the actual binary |
|
|
chdir(dirname(path)); |
|
|
chdir(dirname(path)); |
|
|
|
|
|
if (isCorrectCwd()) |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
// and then go up three directories to get to the parent directory |
|
|
// and then go up three directories to get to the parent directory |
|
|
chdir("../../../"); |
|
|
chdir("../../../"); |
|
|
if (isCorrectCwd()) |
|
|
if (isCorrectCwd()) |
|
|
return; |
|
|
return; |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
// Switch to a default absolute path |
|
|
// Switch to a default absolute path |
|
|
chdir("/Applications/Rack"); |
|
|
chdir("/Applications/Rack"); |
|
|
if (isCorrectCwd()) |
|
|
if (isCorrectCwd()) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
alert("Install Rack", "To install Rack, please move the Rack directory to your /Applications folder.", 2); |
|
|
|
|
|
|
|
|
alert("Install Rack", "To install Rack, please move the Rack directory (including the Rack app and plugins directory) to the /Applications folder.", 2); |
|
|
exit(1); |
|
|
exit(1); |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|