blob: b46e6f890edb5a9b4a7e71c38e60ed583dd4e7fa (
plain) (
tree)
|
|
#include "runtime.h"
#import <Foundation/Foundation.h>
std::string Runtime::getResourcePath(std::string_view filename) {
CFStringRef fileNameRef = CFStringCreateWithCString(kCFAllocatorDefault, filename.data(), kCFStringEncodingUTF8);
CFURLRef appUrlRef = CFBundleCopyResourceURL(CFBundleGetMainBundle(), fileNameRef, NULL, NULL);
CFStringRef filePathRef = CFURLCopyPath(appUrlRef);
const char* filePath = CFStringGetCStringPtr(filePathRef, kCFStringEncodingUTF8);
std::string result(filePath);
CFRelease(filePathRef);
CFRelease(appUrlRef);
CFRelease(fileNameRef);
return result;
}
|