view 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
line wrap: on
line source

#include "sys/osx/filesystem.h"

#include <string>

#import <Foundation/Foundation.h>

namespace osx {

std::string GetApplicationSupportDirectory() {
	NSArray* strings = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, true);
	if (!strings || [strings count] < 1)
		return ""; // ack

	return [[strings objectAtIndex:0] UTF8String];
}

} // namespace osx