diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-06-19 10:10:15 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-06-19 10:10:15 +0200 |
commit | 61d02a395b0ca594640f0fb917d7162a5aba2c37 (patch) | |
tree | 7dd6f7f540dda3d89d37bc7e19f3f4d27dd53c85 /src/utils | |
parent | 5da59b807d9840fb23feb42df729bf5e88ee9678 (diff) | |
parent | ac0b338b3e026d0d05a447894de9a6a994da82dc (diff) | |
download | mana-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')
-rw-r--r-- | src/utils/specialfolder.cpp | 23 | ||||
-rw-r--r-- | src/utils/specialfolder.h | 5 |
2 files changed, 26 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__ diff --git a/src/utils/specialfolder.h b/src/utils/specialfolder.h index 8570d009..36a4e0c1 100644 --- a/src/utils/specialfolder.h +++ b/src/utils/specialfolder.h @@ -27,4 +27,9 @@ std::string getSpecialFolderLocation(const KNOWNFOLDERID &folderId); #endif +#ifdef __APPLE__ +#include <string> +std::string getResourcesLocation(); +#endif + #endif |