~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to intern/ghost/intern/GHOST_SystemPathsCocoa.mm

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * ***** BEGIN GPL LICENSE BLOCK *****
 
3
 *
 
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. 
 
8
 *
 
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.
 
13
 *
 
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.
 
17
 *
 
18
 * The Original Code is Copyright (C) 2010 Blender Foundation.
 
19
 * All rights reserved.
 
20
 *
 
21
 * 
 
22
 * Contributor(s): Damien Plisson 2010
 
23
 *
 
24
 * ***** END GPL LICENSE BLOCK *****
 
25
 */
 
26
 
 
27
#import <Cocoa/Cocoa.h>
 
28
 
 
29
/*For the currently not ported to Cocoa keyboard layout functions (64bit & 10.6 compatible)*/
 
30
#include <Carbon/Carbon.h>
 
31
 
 
32
#include <sys/time.h>
 
33
#include <sys/types.h>
 
34
#include <sys/sysctl.h>
 
35
 
 
36
#include "GHOST_SystemPathsCocoa.h"
 
37
 
 
38
 
 
39
#pragma mark initialization/finalization
 
40
 
 
41
 
 
42
GHOST_SystemPathsCocoa::GHOST_SystemPathsCocoa()
 
43
{
 
44
}
 
45
 
 
46
GHOST_SystemPathsCocoa::~GHOST_SystemPathsCocoa()
 
47
{
 
48
}
 
49
 
 
50
 
 
51
#pragma mark Base directories retrieval
 
52
 
 
53
const GHOST_TUns8* GHOST_SystemPathsCocoa::getSystemDir() const
 
54
{
 
55
        static GHOST_TUns8 tempPath[512] = "";
 
56
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
57
        NSString *basePath;
 
58
        NSArray *paths;
 
59
        
 
60
        paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSLocalDomainMask, YES);
 
61
        
 
62
        if ([paths count] > 0)
 
63
                basePath = [paths objectAtIndex:0];
 
64
        else { 
 
65
                [pool drain];
 
66
                return NULL;
 
67
        }
 
68
        
 
69
        strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
 
70
        
 
71
        [pool drain];
 
72
        return tempPath;
 
73
}
 
74
 
 
75
const GHOST_TUns8* GHOST_SystemPathsCocoa::getUserDir() const
 
76
{
 
77
        static GHOST_TUns8 tempPath[512] = "";
 
78
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
79
        NSString *basePath;
 
80
        NSArray *paths;
 
81
 
 
82
        paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
 
83
 
 
84
        if ([paths count] > 0)
 
85
                basePath = [paths objectAtIndex:0];
 
86
        else { 
 
87
                [pool drain];
 
88
                return NULL;
 
89
        }
 
90
 
 
91
        strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
 
92
        
 
93
        [pool drain];
 
94
        return tempPath;
 
95
}
 
96
 
 
97
const GHOST_TUns8* GHOST_SystemPathsCocoa::getBinaryDir() const
 
98
{
 
99
        static GHOST_TUns8 tempPath[512] = "";
 
100
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
101
        NSString *basePath;
 
102
        
 
103
        basePath = [[NSBundle mainBundle] bundlePath];
 
104
        
 
105
        if (basePath == nil) {
 
106
                [pool drain];
 
107
                return NULL;
 
108
        }
 
109
        
 
110
        strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
 
111
        
 
112
        [pool drain];
 
113
        return tempPath;
 
114
}
 
115
 
 
116
void GHOST_SystemPathsCocoa::addToSystemRecentFiles(const char* filename) const
 
117
{
 
118
        /* XXXXX TODO: Implementation for X11 if possible */
 
119
}