summaryrefslogtreecommitdiffstats
path: root/src/uscxml/URL.mm
blob: e6dc9c51a3c087ec0e1ad054e1ac9d830c634d76 (plain)
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
#include "URL.h"
#include "Foundation/Foundation.h"

#ifdef __has_feature
# if __has_feature(objc_arc)
#   define(HAS_AUTORELEASE_POOL)
# endif
#endif

namespace uscxml {

std::string URL::getResourceDir() {
	std::string path;
#if HAS_AUTORELEASE_POOL
  @autoreleasepool {
#else
		NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#endif
		NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
		path = [resourcePath cStringUsingEncoding:NSUTF8StringEncoding];

#if HAS_AUTORELEASE_POOL
  }
#else
  [pool drain];
#endif
	return path;
}
	
}