File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed
Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -2199,6 +2199,14 @@ if (APPLE)
21992199 MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR} /cmake/MacOSXBundleInfo.plist.in
22002200 RESOURCE ${SerialPrograms_ICON}
22012201 )
2202+
2203+ add_custom_command (
2204+ TARGET SerialPrograms
2205+ POST_BUILD
2206+ COMMAND ${CMAKE_COMMAND} -E copy_directory
2207+ "${CMAKE_CURRENT_SOURCE_DIR} /../Resources"
2208+ "$<TARGET_FILE_DIR:SerialPrograms>/../Resources"
2209+ )
22022210else () # WIN and Linux:
22032211 add_executable (SerialPrograms WIN32 ${MAIN_SOURCES} )
22042212endif ()
Original file line number Diff line number Diff line change 66
77#include < iostream>
88#include < set>
9+ #include < QStandardPaths>
910#include < QCryptographicHash>
1011#include " Common/Cpp/Containers/Pimpl.tpp"
1112#include " Common/Cpp/LifetimeSanitizer.h"
@@ -106,15 +107,25 @@ GlobalSettings::GlobalSettings()
106107 false ,
107108 " <b>Stats File:</b><br>Use the stats file here. Multiple instances of the program can use the same file." ,
108109 LockMode::LOCK_WHILE_RUNNING,
110+ #if defined(__APPLE__)
111+ QStandardPaths::writableLocation (QStandardPaths::AppDataLocation).toStdString() + "/UserSettings/PA-Stats.txt",
112+ QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).toStdString() + "/UserSettings/PA-Stats.txt"
113+ #else
109114 " UserSettings/PA-Stats.txt" ,
110115 " UserSettings/PA-Stats.txt"
116+ #endif
111117 )
112118 , TEMP_FOLDER(
113119 false ,
114120 " <b>Temp Folder:</b><br>Place temporary files in this directory." ,
115121 LockMode::LOCK_WHILE_RUNNING,
122+ #if defined(__APPLE__)
123+ QStandardPaths::writableLocation (QStandardPaths::AppDataLocation).toStdString() + "/TempFiles/",
124+ QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).toStdString() + "/TempFiles/"
125+ #else
116126 " TempFiles/" ,
117127 " TempFiles/"
128+ #endif
118129 )
119130 , THEME(CONSTRUCT_TOKEN)
120131 , WINDOW_SIZE(
Original file line number Diff line number Diff line change 55 */
66
77#include < QCoreApplication>
8+ #include < QStandardPaths>
89#include < QFile>
910#include < QFileInfo>
1011#include < QDir>
@@ -112,9 +113,14 @@ std::string get_training_path(){
112113}
113114
114115std::string get_runtime_base_path (){
116+ // On MacOS, find the writable application support directory
115117 if (QSysInfo::productType () == " macos" || QSysInfo::productType () == " osx" ){
116- QString application_dir_path = get_application_base_dir_path ();
117- return application_dir_path.toStdString () + " /" ;
118+ QString appSupportPath = QStandardPaths::writableLocation (QStandardPaths::AppDataLocation);
119+ QDir dir (appSupportPath);
120+ if (!dir.exists ()) {
121+ dir.mkpath (" ." );
122+ }
123+ return appSupportPath.toStdString () + " /" ;
118124 }
119125 return " ./" ;
120126}
You can’t perform that action at this time.
0 commit comments