Mac Build - Fix bundle directory location
parent
3bb9d06e58
commit
9c6fcc7be5
@ -1,8 +1,34 @@
|
||||
#include "fileops.hpp"
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
bool isFile(const char *name)
|
||||
{
|
||||
boost::filesystem::path cfg_file_path(name);
|
||||
return boost::filesystem::exists(cfg_file_path);
|
||||
}
|
||||
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
std::string macBundlePath()
|
||||
{
|
||||
char path[1024];
|
||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||
assert(mainBundle);
|
||||
|
||||
CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
|
||||
assert(mainBundleURL);
|
||||
|
||||
CFStringRef cfStringRef = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle);
|
||||
assert(cfStringRef);
|
||||
|
||||
CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);
|
||||
|
||||
CFRelease(mainBundleURL);
|
||||
CFRelease(cfStringRef);
|
||||
|
||||
return std::string(path);
|
||||
}
|
||||
#endif
|
||||
|
@ -1,7 +1,13 @@
|
||||
#ifndef __FILEOPS_H_
|
||||
#define __FILEOPS_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
/// Check if a given path is an existing file (not a directory)
|
||||
bool isFile(const char *name);
|
||||
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
std::string macBundlePath();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue