summaryrefslogtreecommitdiff
path: root/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Path.m
blob: 8c54100f7a9dcd00f8e6540ac52e4f4c7a8e3e69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#import "Path.h"

@implementation Path

@synthesize application;
@synthesize resource;
@synthesize documents;
@synthesize library;
@synthesize home;
@synthesize temp;

- (NSString *)application {
    return [[NSBundle mainBundle] bundlePath];
}

- (NSString *)resource {
    return [[NSBundle mainBundle] resourcePath];
}

- (NSString *)documents {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    return [paths objectAtIndex:0];
}

- (NSString *)library {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
    NSLog( @"%@", paths );
    return [paths objectAtIndex:0];
}

- (NSString *)home {
    return NSHomeDirectory();
}

- (NSString *)temp {
    return NSTemporaryDirectory();
}

#pragma mark WebScripting Protocol

/* checks whether a selector is acceptable to be called from JavaScript */
+ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector
{
    return NO;
}

// right now exclude all properties (eg keys)
+ (BOOL) isKeyExcludedFromWebScript:(const char*)name
{
	return NO;
}

@end