304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
IRIByAppendingPathComponent: @"source"];
OFIRI *destinationIRI = [_testsDirectoryIRI
IRIByAppendingPathComponent: @"destination"];
OFFileAttributes attributes;
[@"test" writeToIRI: sourceIRI];
[_fileManager linkItemAtPath: sourceIRI.fileSystemRepresentation
toPath: destinationIRI.fileSystemRepresentation];
attributes = [_fileManager attributesOfItemAtIRI: destinationIRI];
OTAssertEqual(attributes.fileType, OFFileTypeRegular);
OTAssertEqual(attributes.fileSize, 4);
OTAssertEqualObjects([OFString stringWithContentsOfIRI: destinationIRI],
@"test");
}
|
>
>
|
|
>
>
>
|
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
|
IRIByAppendingPathComponent: @"source"];
OFIRI *destinationIRI = [_testsDirectoryIRI
IRIByAppendingPathComponent: @"destination"];
OFFileAttributes attributes;
[@"test" writeToIRI: sourceIRI];
@try {
[_fileManager
linkItemAtPath: sourceIRI.fileSystemRepresentation
toPath: destinationIRI.fileSystemRepresentation];
} @catch (OFNotImplementedException *e) {
OTSkip(@"Links not supported");
}
attributes = [_fileManager attributesOfItemAtIRI: destinationIRI];
OTAssertEqual(attributes.fileType, OFFileTypeRegular);
OTAssertEqual(attributes.fileSize, 4);
OTAssertEqualObjects([OFString stringWithContentsOfIRI: destinationIRI],
@"test");
}
|
346
347
348
349
350
351
352
353
354
355
356
357
358
359
|
} @catch (OFCreateSymbolicLinkFailedException *e) {
if (e.errNo != EPERM)
@throw e;
OTSkip(@"No permission to create symlink.\n"
@"On Windows, only the administrator can create symbolic "
@"links.");
}
attributes = [_fileManager attributesOfItemAtIRI: destinationIRI];
OTAssertEqual(attributes.fileType, OFFileTypeSymbolicLink);
OTAssertEqualObjects([OFString stringWithContentsOfIRI: destinationIRI],
@"test");
}
|
>
>
|
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
|
} @catch (OFCreateSymbolicLinkFailedException *e) {
if (e.errNo != EPERM)
@throw e;
OTSkip(@"No permission to create symlink.\n"
@"On Windows, only the administrator can create symbolic "
@"links.");
} @catch (OFNotImplementedException *e) {
OTSkip(@"Symlinks not supported");
}
attributes = [_fileManager attributesOfItemAtIRI: destinationIRI];
OTAssertEqual(attributes.fileType, OFFileTypeSymbolicLink);
OTAssertEqualObjects([OFString stringWithContentsOfIRI: destinationIRI],
@"test");
}
|