251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
@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
|
|
|
|
|
|
|
|
|
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
@throw [OFChangeFileOwnerFailedException newWithClass: self
path: path
owner: owner
group: group];
}
#endif
+ (void)renameFileAtPath: (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)deleteFileAtPath: (OFString*)path
{
#ifndef _WIN32
if (unlink([path cString]))
#else
if (!DeleteFile([path cString]))
#endif
@throw [OFDeleteFileFailedException newWithClass: self
path: path];
}
#ifndef _WIN32
+ (void)linkFileAtPath: (OFString*)src
toPath: (OFString*)dest
{
if (link([src cString], [dest cString]) != 0)
@throw [OFLinkFailedException newWithClass: self
source: src
destination: dest];
}
+ (void)symlinkFileAtPath: (OFString*)src
toPath: (OFString*)dest
{
if (symlink([src cString], [dest cString]) != 0)
@throw [OFSymlinkFailedException newWithClass: self
source: src
destination: dest];
}
#endif
|