#endif
#if defined (USE_MACOSX_PACKAGING)
-# include <CoreServices/CoreServices.h> // FSFindFolder, FSRefMakePath
+# include "support/qstring_helpers.h"
+# include <QDir>
+# include <QDesktopServices>
#endif
using namespace std;
{
#if defined (USE_WINDOWS_PACKAGING)
static FileName const home_dir(getEnv("USERPROFILE"));
+#elif defined (USE_MACOSX_PACKAGING)
+ static FileName const home_dir(fromqstr(QDir::homePath()));
#else // Posix-like.
static FileName const home_dir(getEnv("HOME"));
#endif
(void)home_dir; // Silence warning about unused variable.
os::GetFolderPath win32_folder_path;
return FileName(win32_folder_path(os::GetFolderPath::PERSONAL));
+#elif defined (USE_MACOSX_PACKAGING)
+ (void)home_dir; // Silence warning about unused variable.
+ return FileName(fromqstr(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)));
#else // Posix-like.
return home_dir;
#endif
#elif defined (USE_MACOSX_PACKAGING)
(void)home_dir; // Silence warning about unused variable.
-
- FSRef fsref;
- OSErr const error_code =
- FSFindFolder(kUserDomain, kApplicationSupportFolderType,
- kDontCreateFolder, &fsref);
- if (error_code != 0)
- return FileName();
-
- // FSRefMakePath returns the result in utf8
- char store[PATH_MAX + 1];
- OSStatus const status_code =
- FSRefMakePath(&fsref,
- reinterpret_cast<UInt8*>(store), PATH_MAX);
- if (status_code != 0)
- return FileName();
-
- return FileName(addPath(reinterpret_cast<char const *>(store), PACKAGE));
+ return FileName(addPath(fromqstr(QDesktopServices::storageLocation(QDesktopServices::DataLocation)), PACKAGE));
#else // USE_POSIX_PACKAGING
return FileName(addPath(home_dir.absFileName(), string(".") + PACKAGE));