diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-20 11:52:09 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-20 11:52:09 -0400 |
commit | a07d588c94f68cdc559ceb016c031c9199f0b868 (patch) | |
tree | 839b078d07f3c727bcce8f3ce340c2639e306143 /src/runtime_macos.mm | |
parent | 9458529e94ec3135a5a6fa0fbaf7e0ce1459168b (diff) | |
download | ether-a07d588c94f68cdc559ceb016c031c9199f0b868.tar.gz ether-a07d588c94f68cdc559ceb016c031c9199f0b868.tar.bz2 ether-a07d588c94f68cdc559ceb016c031c9199f0b868.zip |
we can now build a mac bundle!
Diffstat (limited to 'src/runtime_macos.mm')
-rw-r--r-- | src/runtime_macos.mm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/runtime_macos.mm b/src/runtime_macos.mm new file mode 100644 index 0000000..b46e6f8 --- /dev/null +++ b/src/runtime_macos.mm | |||
@@ -0,0 +1,16 @@ | |||
1 | #include "runtime.h" | ||
2 | #import <Foundation/Foundation.h> | ||
3 | |||
4 | std::string Runtime::getResourcePath(std::string_view filename) { | ||
5 | CFStringRef fileNameRef = CFStringCreateWithCString(kCFAllocatorDefault, filename.data(), kCFStringEncodingUTF8); | ||
6 | CFURLRef appUrlRef = CFBundleCopyResourceURL(CFBundleGetMainBundle(), fileNameRef, NULL, NULL); | ||
7 | CFStringRef filePathRef = CFURLCopyPath(appUrlRef); | ||
8 | const char* filePath = CFStringGetCStringPtr(filePathRef, kCFStringEncodingUTF8); | ||
9 | std::string result(filePath); | ||
10 | |||
11 | CFRelease(filePathRef); | ||
12 | CFRelease(appUrlRef); | ||
13 | CFRelease(fileNameRef); | ||
14 | |||
15 | return result; | ||
16 | } | ||