2
* ***** BEGIN GPL LICENSE BLOCK *****
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software Foundation,
16
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
* The Original Code is Copyright (C) 2010 Blender Foundation.
19
* All rights reserved.
22
* Contributor(s): Damien Plisson 2010
24
* ***** END GPL LICENSE BLOCK *****
27
#import <Cocoa/Cocoa.h>
29
/*For the currently not ported to Cocoa keyboard layout functions (64bit & 10.6 compatible)*/
30
#include <Carbon/Carbon.h>
33
#include <sys/types.h>
34
#include <sys/sysctl.h>
36
#include "GHOST_SystemPathsCocoa.h"
39
#pragma mark initialization/finalization
42
GHOST_SystemPathsCocoa::GHOST_SystemPathsCocoa()
46
GHOST_SystemPathsCocoa::~GHOST_SystemPathsCocoa()
51
#pragma mark Base directories retrieval
53
const GHOST_TUns8* GHOST_SystemPathsCocoa::getSystemDir() const
55
static GHOST_TUns8 tempPath[512] = "";
56
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
60
paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSLocalDomainMask, YES);
62
if ([paths count] > 0)
63
basePath = [paths objectAtIndex:0];
69
strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
75
const GHOST_TUns8* GHOST_SystemPathsCocoa::getUserDir() const
77
static GHOST_TUns8 tempPath[512] = "";
78
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
82
paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
84
if ([paths count] > 0)
85
basePath = [paths objectAtIndex:0];
91
strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
97
const GHOST_TUns8* GHOST_SystemPathsCocoa::getBinaryDir() const
99
static GHOST_TUns8 tempPath[512] = "";
100
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
103
basePath = [[NSBundle mainBundle] bundlePath];
105
if (basePath == nil) {
110
strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
116
void GHOST_SystemPathsCocoa::addToSystemRecentFiles(const char* filename) const
118
/* XXXXX TODO: Implementation for X11 if possible */