5#import <AppKit/NSDocumentController.h>
6#import <Foundation/Foundation.h>
19 const NSSearchPathDomainMask
mask,
21 const std::size_t len_tempPath)
24 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
mask, YES);
26 if (paths.count == 0) {
29 NSString *basePath = [paths objectAtIndex:0];
34 [basePath cStringUsingEncoding:NSASCIIStringEncoding],
42 static char tempPath[512] =
"";
48 static char tempPath[512] =
"";
55 char tempPath[512] =
"";
57 NSSearchPathDirectory ns_directory;
61 ns_directory = NSDesktopDirectory;
64 ns_directory = NSDocumentDirectory;
67 ns_directory = NSDownloadsDirectory;
70 ns_directory = NSMusicDirectory;
73 ns_directory = NSPicturesDirectory;
76 ns_directory = NSMoviesDirectory;
79 ns_directory = NSCachesDirectory;
84 "GHOST_SystemPathsCocoa::getUserSpecialDir(): Invalid enum value for type parameter");
88 NSArray *paths = NSSearchPathForDirectoriesInDomains(ns_directory, NSUserDomainMask, YES);
89 if (paths.count == 0) {
92 NSString *basePath = [paths objectAtIndex:0];
94 const char *basePath_cstr = [basePath cStringUsingEncoding:NSASCIIStringEncoding];
95 int basePath_len = strlen(basePath_cstr);
97 basePath_len =
MIN(basePath_len,
sizeof(tempPath) - 1);
98 memcpy(tempPath, basePath_cstr, basePath_len);
99 tempPath[basePath_len] =
'\0';
109 static char tempPath[512] =
"";
112 NSString *basePath = [[NSBundle mainBundle] bundlePath];
114 if (basePath == nil) {
118 const char *basePath_cstr = [basePath cStringUsingEncoding:NSASCIIStringEncoding];
119 int basePath_len = strlen(basePath_cstr);
121 basePath_len =
MIN(basePath_len,
sizeof(tempPath) - 1);
122 memcpy(tempPath, basePath_cstr, basePath_len);
123 tempPath[basePath_len] =
'\0';
131 NSURL *file_url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:filepath]];
132 [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:file_url];
#define GHOST_ASSERT(x, info)
static const char * GetApplicationSupportDir(const char *versionstr, const NSSearchPathDomainMask mask, char *tempPath, const std::size_t len_tempPath)
GHOST_TUserSpecialDirTypes
@ GHOST_kUserSpecialDirDesktop
@ GHOST_kUserSpecialDirMusic
@ GHOST_kUserSpecialDirPictures
@ GHOST_kUserSpecialDirVideos
@ GHOST_kUserSpecialDirDownloads
@ GHOST_kUserSpecialDirCaches
@ GHOST_kUserSpecialDirDocuments
const char * getBinaryDir() const override
void addToSystemRecentFiles(const char *filepath) const override
const char * getUserDir(int version, const char *versionstr) const override
std::optional< std::string > getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const override
const char * getSystemDir(int version, const char *versionstr) const override
ccl_device_inline float2 mask(const MaskType mask, const float2 a)