diff options
author | Brad King <brad.king@kitware.com> | 2020-06-15 13:36:17 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-06-15 13:36:22 (GMT) |
commit | 148a5c2d42059289f2af3376b844ba53b5e12f13 (patch) | |
tree | a0d0a9f1a8b8fc3bcf220b6653d9090627e7e2f9 /Source | |
parent | 29e9b46ca5b50c6342b6e59ded8041cf1251094d (diff) | |
parent | d3fd518c0316b15e4680c32808788935bf8c5c3d (diff) | |
download | CMake-148a5c2d42059289f2af3376b844ba53b5e12f13.zip CMake-148a5c2d42059289f2af3376b844ba53b5e12f13.tar.gz CMake-148a5c2d42059289f2af3376b844ba53b5e12f13.tar.bz2 |
Merge topic 'bundle-exe-space-in-name'
d3fd518c03 find_program: Properly decode URL for bundle exe name with spaces
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4891
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmFindProgramCommand.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 4b88bea..4f3fcdd 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -266,14 +266,13 @@ std::string cmFindProgramCommand::GetBundleExecutable( if (executableURL != nullptr) { const int MAX_OSX_PATH_SIZE = 1024; - char buffer[MAX_OSX_PATH_SIZE]; + UInt8 buffer[MAX_OSX_PATH_SIZE]; - // Convert the CFString to a C string - CFStringGetCString(CFURLGetString(executableURL), buffer, - MAX_OSX_PATH_SIZE, kCFStringEncodingUTF8); - - // And finally to a c++ string - executable = bundlePath + "/Contents/MacOS/" + std::string(buffer); + if (CFURLGetFileSystemRepresentation(executableURL, false, buffer, + MAX_OSX_PATH_SIZE)) { + executable = bundlePath + "/Contents/MacOS/" + + std::string(reinterpret_cast<char*>(buffer)); + } // Only release CFURLRef if it's not null CFRelease(executableURL); } |