summaryrefslogtreecommitdiff
path: root/lib/ffs_paths.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:23:48 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:23:48 +0200
commitee1c8c5c25d25dfa42120125a8a45dc9831ee412 (patch)
tree67aa287157db954e0cadeee05b4aad331eb2ecf2 /lib/ffs_paths.cpp
parent5.13 (diff)
downloadFreeFileSync-ee1c8c5c25d25dfa42120125a8a45dc9831ee412.tar.gz
FreeFileSync-ee1c8c5c25d25dfa42120125a8a45dc9831ee412.tar.bz2
FreeFileSync-ee1c8c5c25d25dfa42120125a8a45dc9831ee412.zip
5.14
Diffstat (limited to 'lib/ffs_paths.cpp')
-rw-r--r--lib/ffs_paths.cpp25
1 files changed, 6 insertions, 19 deletions
diff --git a/lib/ffs_paths.cpp b/lib/ffs_paths.cpp
index 3a0b557d..82232b5c 100644
--- a/lib/ffs_paths.cpp
+++ b/lib/ffs_paths.cpp
@@ -12,7 +12,9 @@
#ifdef FFS_MAC
#include <vector>
#include <zen/scope_guard.h>
-#include <CoreServices/CoreServices.h> //keep in .cpp file to not pollute global namespace! e.g. with UInt64
+#include <zen/osx_string.h>
+//keep in .cpp file to not pollute global namespace! e.g. with UInt64:
+#include <ApplicationServices/ApplicationServices.h> //LSFindApplicationForInfo
#endif
using namespace zen;
@@ -102,26 +104,11 @@ Zstring zen::getFreeFileSyncLauncher()
{
#ifdef FFS_WIN
return getInstallDir() + Zstr("FreeFileSync.exe");
+
#elif defined FFS_LINUX
return getExecutableDir() + Zstr("FreeFileSync");
-#elif defined FFS_MAC
- auto CFStringRefToUtf8 = [](const CFStringRef& cfs) -> Zstring
- {
- if (cfs)
- {
- CFIndex length = ::CFStringGetLength(cfs);
- if (length > 0)
- {
- CFIndex bufferSize = ::CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8);
- std::vector<char> buffer(bufferSize);
-
- if (::CFStringGetCString(cfs, &buffer[0], bufferSize, kCFStringEncodingUTF8))
- return Zstring(&buffer[0]);
- }
- }
- return Zstring();
- };
+#elif defined FFS_MAC
CFURLRef appURL = nullptr;
ZEN_ON_SCOPE_EXIT(if (appURL) ::CFRelease(appURL));
@@ -138,7 +125,7 @@ Zstring zen::getFreeFileSyncLauncher()
if (CFStringRef path = ::CFURLCopyFileSystemPath(absUrl, kCFURLPOSIXPathStyle))
{
ZEN_ON_SCOPE_EXIT(::CFRelease(path));
- return appendSeparator(CFStringRefToUtf8(path)) + "Contents/MacOS/FreeFileSync";
+ return appendSeparator(osx::cfStringToZstring(path)) + "Contents/MacOS/FreeFileSync";
}
}
return Zstr("./FreeFileSync"); //fallback: at least give some hint...
bgstack15