summaryrefslogtreecommitdiff
path: root/src/utils/specialfolder.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-13 15:45:37 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-04-17 14:34:48 +0200
commitaecbf876cd0a7894396a2e5034af9d93bf028aa0 (patch)
tree9b5742ee8e610cd396116eb56aa3fd764a4a8b56 /src/utils/specialfolder.cpp
parent4a730fa0b08c68fc01f35b79a43fdd72411f2b83 (diff)
downloadmana-aecbf876cd0a7894396a2e5034af9d93bf028aa0.tar.gz
mana-aecbf876cd0a7894396a2e5034af9d93bf028aa0.tar.bz2
mana-aecbf876cd0a7894396a2e5034af9d93bf028aa0.tar.xz
mana-aecbf876cd0a7894396a2e5034af9d93bf028aa0.zip
macOS: Create an app bundle
Also enable using `cpack -G DragNDrop` to create a DMG to easily drag Mana into the Applications folder. The DMG is also available as a CI artifact. The minimum deployment target has been set to 10.15, as required due to usage of std::filesystem::create_directories.
Diffstat (limited to 'src/utils/specialfolder.cpp')
-rw-r--r--src/utils/specialfolder.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/utils/specialfolder.cpp b/src/utils/specialfolder.cpp
index c351ba1a..c882534d 100644
--- a/src/utils/specialfolder.cpp
+++ b/src/utils/specialfolder.cpp
@@ -18,8 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef _WIN32
#include "specialfolder.h"
+
+#ifdef _WIN32
#include <windows.h>
#include <stdlib.h>
@@ -74,4 +75,22 @@ int main()
<< std::endl;
}
#endif
-#endif
+#endif // _WIN32
+
+#ifdef __APPLE__
+#include <CoreFoundation/CFBundle.h>
+
+std::string getResourcesLocation()
+{
+ CFBundleRef mainBundle = CFBundleGetMainBundle();
+ CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
+ char path[PATH_MAX];
+ if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path,
+ PATH_MAX))
+ {
+ fprintf(stderr, "Can't find Resources directory\n");
+ }
+ CFRelease(resourcesURL);
+ return path;
+}
+#endif // __APPLE__