1
0
mirror of synced 2024-12-15 17:21:16 +01:00
ImHex/plugins/libimhex/source/helpers/paths_mac.mm
Kuruyia 72ec6baf79
sys: Fix macOS compilation (as of 2dc1886) (#317)
* sys: Updated curl to latest version

* sys: Fix macOS compilation

* ui: Fix splash screen OpenGL init for macOS

* sys: Fix std::min compile errors

* git: Re-enabled macos workflow

* sys: Remove includes of the range library

* build: Find OpenGL using CMake

* sys/build: Fix bundled plugins on macOS

* build: Copy plugins to bundle when creating a bundle

* build: Fixup bundled plugins

* sys: Search for plugins in the bundle instead of in Application Support

* sys: Allow resources to be placed in multiple directories on macOS

* build: Output built plugins to the plugins/ directory when not creating a bundle on macOS

* sys: Fix Application Support paths on macOS

* sys: Define ftruncate64 on macOS

* sys: Fix absolute value computation for std::string::at on macOS

Co-authored-by: WerWolv <werwolv98@gmail.com>
2021-10-09 23:07:58 +02:00

31 lines
1.1 KiB
Plaintext

#if defined(OS_MACOS)
#include <hex/helpers/paths_mac.h>
#include <Foundation/Foundation.h>
namespace hex {
std::string getMacExecutableDirectoryPath() {
@autoreleasepool {
return {[[[[[NSBundle mainBundle] executableURL] URLByDeletingLastPathComponent] path] UTF8String]};
}
}
std::string getMacApplicationSupportDirectoryPath() {
@autoreleasepool {
NSError* error = nil;
NSURL* dirUrl = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory
inDomain:NSUserDomainMask
appropriateForURL:nil
create:YES
error:&error];
if (error != nil) {
__builtin_unreachable();
}
return {[[[dirUrl URLByAppendingPathComponent:(@"imhex")] path] UTF8String]};
}
}
}
#endif