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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
+ newWithPath: (const char*)path
andMode: (const char*)mode
{
return [[OFFile alloc] initWithPath: path
andMode: mode];
}
+ (int)changeModeOfFile: (const char*)path
toMode: (mode_t)mode
{
// FIXME: On error, throw exception
return chmod(path, mode);
}
+ (int)changeOwnerOfFile: (const char*)path
toOwner: (uid_t)owner
andGroup: (gid_t)group
{
// FIXME: On error, throw exception
return chown(path, owner, group);
}
+ (int)delete: (const char*)path
{
// FIXME: On error, throw exception
return unlink(path);
}
+ (int)link: (const char*)src
to: (const char*)dest
{
// FIXME: On error, throw exception
return link(src, dest);
}
+ (int)symlink: (const char*)src
to: (const char*)dest
{
// FIXME: On error, throw exception
return symlink(src, dest);
}
- initWithPath: (const char*)path
andMode: (const char*)mode
{
if ((self = [super init])) {
if ((fp = fopen(path, mode)) == NULL)
|
|
|
|
|
|
|
|
|
|
|
|
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
+ newWithPath: (const char*)path
andMode: (const char*)mode
{
return [[OFFile alloc] initWithPath: path
andMode: mode];
}
+ (BOOL)changeModeOfFile: (const char*)path
toMode: (mode_t)mode
{
// FIXME: On error, throw exception
return (chmod(path, mode) == 0 ? YES : NO);
}
+ (BOOL)changeOwnerOfFile: (const char*)path
toOwner: (uid_t)owner
andGroup: (gid_t)group
{
// FIXME: On error, throw exception
return (chown(path, owner, group) == 0 ? YES : NO);
}
+ (BOOL)delete: (const char*)path
{
// FIXME: On error, throw exception
return (unlink(path) == 0 ? YES : NO);
}
+ (BOOL)link: (const char*)src
to: (const char*)dest
{
// FIXME: On error, throw exception
return (link(src, dest) == 0 ? YES : NO);
}
+ (BOOL)symlink: (const char*)src
to: (const char*)dest
{
// FIXME: On error, throw exception
return (symlink(src, dest) == 0 ? YES : NO);
}
- initWithPath: (const char*)path
andMode: (const char*)mode
{
if ((self = [super init])) {
if ((fp = fopen(path, mode)) == NULL)
|