mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
Fix Mac OS X specific path bug
In Mac OS X, if a path contains a space, the path of the main executable will contain a special URL-encoded character (%20 in this case). This probably happens when any non-ASCII character is provided. The fix is to use CFURLCreateStringByReplacingPercentEscapes which creates a path that the POSIX API likes better.
This commit is contained in:
parent
3e5b2cbc7b
commit
9909c0cec3
@ -93,6 +93,8 @@ pathOfExecutable(System* s, const char** retBuf, unsigned* size)
|
||||
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||
CFURLRef url = CFBundleCopyExecutableURL(bundle);
|
||||
CFStringRef path = CFURLCopyPath(url);
|
||||
path = CFURLCreateStringByReplacingPercentEscapes(kCFAllocatorDefault,
|
||||
path, CFSTR(""));
|
||||
CFIndex pathSize = CFStringGetMaximumSizeOfFileSystemRepresentation(path);
|
||||
char* buffer = reinterpret_cast<char*>(allocate(s, pathSize));
|
||||
if (CFStringGetFileSystemRepresentation(path, buffer, pathSize)) {
|
||||
|
Loading…
Reference in New Issue
Block a user