# HG changeset patch # User Paper # Date 1701709416 18000 # Node ID 9c4645100fece2ab28ed84cf739b4ce2a8a89e63 # Parent bc8d2ccff09ceae9244573c46849fed899e950fb 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... diff -r bc8d2ccff09c -r 9c4645100fec CMakeLists.txt --- a/CMakeLists.txt Mon Dec 04 11:51:30 2023 -0500 +++ b/CMakeLists.txt Mon Dec 04 12:03:36 2023 -0500 @@ -43,8 +43,9 @@ # We need Cocoa for some OS X stuff if(APPLE) - find_library(COCOA_LIBRARY Cocoa) - list(APPEND LIBRARIES ${COCOA_LIBRARY}) + find_library(FOUNDATION_LIBRARY Foundation) + find_library(APPKIT_LIBRARY AppKit) + list(APPEND LIBRARIES ${FOUNDATION_LIBRARY} ${APPKIT_LIBRARY}) endif() set(SRC_FILES diff -r bc8d2ccff09c -r 9c4645100fec src/sys/osx/dark_theme.mm --- a/src/sys/osx/dark_theme.mm Mon Dec 04 11:51:30 2023 -0500 +++ b/src/sys/osx/dark_theme.mm Mon Dec 04 12:03:36 2023 -0500 @@ -1,10 +1,12 @@ #include "sys/osx/dark_theme.h" -#import + +#import namespace osx { /* I remember clang giving a hissy fit when I tried simplifying this to just - a return; does it still do that? */ + * a return; does it still do that? +*/ bool DarkThemeAvailable() { if (@available(macOS 10.14, *)) return true; diff -r bc8d2ccff09c -r 9c4645100fec src/sys/osx/filesystem.mm --- a/src/sys/osx/filesystem.mm Mon Dec 04 11:51:30 2023 -0500 +++ b/src/sys/osx/filesystem.mm Mon Dec 04 12:03:36 2023 -0500 @@ -1,11 +1,17 @@ -#include +#include "sys/osx/filesystem.h" + #include +#import + namespace osx { std::string GetApplicationSupportDirectory() { NSArray* strings = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, true); - return std::string([[strings objectAtIndex:0] UTF8String]); + if (!strings || [strings count] < 1) + return ""; // ack + + return [[strings objectAtIndex:0] UTF8String]; } } // namespace osx