152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
@throw [OFChangeFileOwnerFailedException newWithClass: self
path: path
owner: owner
group: group];
}
#endif
+ (void)rename: (OFString*)from
to: (OFString*)to
{
#ifndef _WIN32
if (rename([from cString], [to cString]))
#else
if (!MoveFile([from cString], [to cString]))
#endif
@throw [OFRenameFileFailedException newWithClass: self
from: from
to: to];
}
+ (void)delete: (OFString*)path
{
#ifndef _WIN32
if (unlink([path cString]))
#else
if (!DeleteFile([path cString]))
#endif
@throw [OFDeleteFileFailedException newWithClass: self
path: path];
}
#ifndef _WIN32
+ (void)link: (OFString*)src
to: (OFString*)dest
{
if (link([src cString], [dest cString]) != 0)
@throw [OFLinkFailedException newWithClass: self
source: src
destination: dest];
}
+ (void)symlink: (OFString*)src
to: (OFString*)dest
{
if (symlink([src cString], [dest cString]) != 0)
@throw [OFSymlinkFailedException newWithClass: self
source: src
destination: dest];
}
#endif
|
|
|
|
|
|
|
|
|
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
@throw [OFChangeFileOwnerFailedException newWithClass: self
path: path
owner: owner
group: group];
}
#endif
+ (void)renameFileWithPath: (OFString*)from
toPath: (OFString*)to
{
#ifndef _WIN32
if (rename([from cString], [to cString]))
#else
if (!MoveFile([from cString], [to cString]))
#endif
@throw [OFRenameFileFailedException newWithClass: self
from: from
to: to];
}
+ (void)deleteFileWithPath: (OFString*)path
{
#ifndef _WIN32
if (unlink([path cString]))
#else
if (!DeleteFile([path cString]))
#endif
@throw [OFDeleteFileFailedException newWithClass: self
path: path];
}
#ifndef _WIN32
+ (void)linkFileWithPath: (OFString*)src
toPath: (OFString*)dest
{
if (link([src cString], [dest cString]) != 0)
@throw [OFLinkFailedException newWithClass: self
source: src
destination: dest];
}
+ (void)symlinkFileWithPath: (OFString*)src
toPath: (OFString*)dest
{
if (symlink([src cString], [dest cString]) != 0)
@throw [OFSymlinkFailedException newWithClass: self
source: src
destination: dest];
}
#endif
|