ObjFW  Diff

Differences From Artifact [8a9dff998b]:

To Artifact [ade2f827ca]:


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

71
72
73

74
75
76
77
78
79
80
+ newWithPath: (const char*)path
      andMode: (const char*)mode
{
	return [[self alloc] initWithPath: path
				    andMode: mode];
}

#ifndef _WIN32
+ (BOOL)changeModeOfFile: (const char*)path
		  toMode: (mode_t)mode
{

	// FIXME: On error, throw exception



	return (chmod(path, mode) == 0 ? YES : NO);
}
#endif

#ifndef _WIN32
+ (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);
}
#endif


+ (BOOL)delete: (const char*)path
{
	// FIXME: On error, throw exception
	return (unlink(path) == 0 ? YES : NO);
}

#ifndef _WIN32
+ (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);
}
#endif


- initWithPath: (const char*)path
       andMode: (const char*)mode
{
	if ((self = [super init])) {
		if ((fp = fopen(path, mode)) == NULL)
			@throw [OFOpenFileFailedException newWithObject: self







<
|


>
|
>
>
>
|
<

|
|
|



|
>
|
<

|
>
|

|
|


<
|


|
>
|
>


|


|
>
|
<

>







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
71
72
73
74
75
76

77
78
79
80
81
82
83
84
85
+ newWithPath: (const char*)path
      andMode: (const char*)mode
{
	return [[self alloc] initWithPath: path
				    andMode: mode];
}


+ (void)changeModeOfFile: (const char*)path
		  toMode: (mode_t)mode
{
	/*
	 * FIXME: On error, throw exception
	 * FIXME: On Win32, change write access
	 */
#ifndef _WIN32
	chmod(path, mode);

#endif
}

+ (void)changeOwnerOfFile: (const char*)path
		  toOwner: (uid_t)owner
		 andGroup: (gid_t)group
{
	/* FIXME: On error, throw exception */
#ifndef _WIN32
	chown(path, owner, group);

#endif
}

+ (void)delete: (const char*)path
{
	/* FIXME: On error, throw exception */
	unlink(path);
}


+ (void)link: (const char*)src
	  to: (const char*)dest
{
	/* FIXME: On error, throw exception */
#ifndef _WIN32
	link(src, dest);
#endif
}

+ (void)symlink: (const char*)src
	     to: (const char*)dest
{
	/* FIXME: On error, throw exception */
#ifndef _WIN32
	symlink(src, dest);

#endif
}

- initWithPath: (const char*)path
       andMode: (const char*)mode
{
	if ((self = [super init])) {
		if ((fp = fopen(path, mode)) == NULL)
			@throw [OFOpenFileFailedException newWithObject: self