create Xcode project for mac for bundled app

This commit is contained in:
2017-05-18 13:29:18 +01:00
parent 6d14ccd426
commit 4c5b22192b
15 changed files with 1408 additions and 359 deletions

View File

@@ -2,7 +2,7 @@
#include "log.h"
#include "asset.h"
#ifdef __IOS__
#ifdef __APPLE__
#include <Foundation/Foundation.h>
#endif
@@ -24,11 +24,12 @@ bool Asset::open(const char* path)
m_len = (int)AAsset_getLength(m_asset);
m_data = (uint8_t*)AAsset_getBuffer(m_asset);
#else
#ifdef __IOS__
NSString* bundle_path = [[NSBundle mainBundle] bundlePath];
#ifdef __APPLE__
NSString* bundle_path = [[NSBundle mainBundle] resourcePath];
std::string base = [bundle_path cStringUsingEncoding:1];
file_path = base + "/" + path;
#endif
LOG("asset file: %s", file_path.c_str());
if (!(m_fp = fopen(file_path.c_str(), "rb")))
{
LOG("errno = %d", errno);