Add new symbolic link method to NSFileManager.

This commit is contained in:
fredkiefer 2017-12-03 21:55:33 +01:00
parent 4b56172ac8
commit 97f9a02308
3 changed files with 35 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2017-12-03 Fred Kiefer <fredkiefer@gmx.de>
* Headers/Foundation/NSFileManager.h
* Source/NSFileManager.m: Correct setting the delegate.
Add new symbolic link method.
2017-11-16 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSArray.m: Fix for bug reported on github by zneak.

View file

@ -302,6 +302,14 @@ typedef NSUInteger NSDirectoryEnumerationOptions;
*/
- (BOOL) removeItemAtURL: (NSURL*)url
error: (NSError**)error;
/**
* Creates a symbolic link at the path
* that point to the destination path.<br />
* Returns YES on success, otherwise NO.
*/
- (BOOL) createSymbolicLinkAtPath: (NSString*)path
withDestinationPath: (NSString*)destPath
error: (NSError**)error;
#endif
/**

View file

@ -361,7 +361,7 @@ static NSStringEncoding defaultEncoding;
return _delegate;
}
- (void) setDelegate: (NSFileManager *)delegate {
- (void) setDelegate: (id<NSFileManagerDelegate>)delegate {
_delegate = delegate;
}
@ -1586,6 +1586,26 @@ static NSStringEncoding defaultEncoding;
return [self removeItemAtPath: [url path] error: error];
}
- (BOOL) createSymbolicLinkAtPath: (NSString*)path
withDestinationPath: (NSString*)destPath
error: (NSError**)error
{
BOOL result;
DESTROY(_lastError);
result = [self createSymbolicLinkAtPath: path pathContent: destPath];
if (error != NULL)
{
if (NO == result)
{
*error = [self _errorFrom: path to: destPath];
}
}
return result;
}
- (BOOL) fileExistsAtPath: (NSString*)path
{
return [self fileExistsAtPath: path isDirectory: 0];