Guest User

Untitled

a guest
Nov 9th, 2021
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include "ResourcePath.hpp"
  2. #import <Foundation/Foundation.h>
  3.  
  4. ////////////////////////////////////////////////////////////
  5. std::string resourcePath(void)
  6. {
  7.     NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
  8.  
  9.     std::string rpath;
  10.     NSBundle* bundle = [NSBundle mainBundle];
  11.  
  12.     if (bundle == nil) {
  13. #ifdef DEBUG
  14.         NSLog(@"bundle is nil... thus no resources path can be found.");
  15. #endif
  16.     } else {
  17.         NSString* path = [bundle resourcePath];
  18.         rpath = [path UTF8String] + std::string("/");
  19.     }
  20.  
  21.     [pool drain];
  22.  
  23.     return rpath;
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment