-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUtils.h
More file actions
45 lines (37 loc) · 1019 Bytes
/
Utils.h
File metadata and controls
45 lines (37 loc) · 1019 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* Utils.h
* Prototyp
*
* Created by Christian Pehle on 04.09.09.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#ifndef Utils_H
#define Utils_H
namespace Orbifold {
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
#include <CoreFoundation/CoreFoundation.h>
/*
* This function will return the appropriate working directory depending
* on the platform. For Windows, a blank string will suffice. For OS X,
* however, we need to do a little extra work.
*/
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
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#endif
}
#endif