Mercurial > minori
comparison src/sys/osx/filesystem.mm @ 179:9c4645100fec
osx: clean up includes, we do not need cocoa
what we *do* need is the very basics that animia already depends on anyway.
these are basically guaranteed to be on any macos system, making it fairly portable
now... I haven't tested this :) I don't have a macos machine right now...
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Mon, 04 Dec 2023 12:03:36 -0500 |
parents | cde8f67a7c7d |
children |
comparison
equal
deleted
inserted
replaced
178:bc8d2ccff09c | 179:9c4645100fec |
---|---|
1 #include <Cocoa/Cocoa.h> | 1 #include "sys/osx/filesystem.h" |
2 | |
2 #include <string> | 3 #include <string> |
4 | |
5 #import <Foundation/Foundation.h> | |
3 | 6 |
4 namespace osx { | 7 namespace osx { |
5 | 8 |
6 std::string GetApplicationSupportDirectory() { | 9 std::string GetApplicationSupportDirectory() { |
7 NSArray* strings = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, true); | 10 NSArray* strings = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, true); |
8 return std::string([[strings objectAtIndex:0] UTF8String]); | 11 if (!strings || [strings count] < 1) |
12 return ""; // ack | |
13 | |
14 return [[strings objectAtIndex:0] UTF8String]; | |
9 } | 15 } |
10 | 16 |
11 } // namespace osx | 17 } // namespace osx |