summaryrefslogtreecommitdiff
path: root/src/utils/specialfolder.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-06-19 10:10:15 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-06-19 10:10:15 +0200
commit61d02a395b0ca594640f0fb917d7162a5aba2c37 (patch)
tree7dd6f7f540dda3d89d37bc7e19f3f4d27dd53c85 /src/utils/specialfolder.cpp
parent5da59b807d9840fb23feb42df729bf5e88ee9678 (diff)
parentac0b338b3e026d0d05a447894de9a6a994da82dc (diff)
downloadmana-online-player-list.tar.gz
mana-online-player-list.tar.bz2
mana-online-player-list.tar.xz
mana-online-player-list.zip
Merge branch 'master' into online-player-listonline-player-list
Conflicts: src/net/tmwa/chathandler.cpp
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__