CIOSUtils.m 987 B

1234567891011121314151617181920212223242526
  1. /*
  2. * CIOSUtils.m, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #import "CIOSUtils.h"
  11. @import Foundation;
  12. static const char *standardPath(NSSearchPathDirectory directory)
  13. {
  14. return [NSFileManager.defaultManager URLForDirectory:directory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:NULL].path.UTF8String;
  15. }
  16. const char *ios_documentsPath() { return standardPath(NSDocumentDirectory); }
  17. const char *ios_cachesPath() { return standardPath(NSCachesDirectory); }
  18. const char *ios_bundlePath() { return NSBundle.mainBundle.bundlePath.UTF8String; }
  19. const char *ios_frameworksPath() { return [NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:@"Frameworks"].UTF8String; } // TODO: sharedFrameworksPath?
  20. const char *ios_bundleIdentifier() { return NSBundle.mainBundle.bundleIdentifier.UTF8String; }