NSURL: implement +fileURLWithPath:isDirectory:

Implement +[NSURL fileURLWithPath:isDirectory:], a class method added in
OSX 10.5, which was missing from the implementation.
This commit is contained in:
Daniel Ferreira 2017-06-22 06:41:10 +10:00 committed by Ivan Vučica
parent 314f437f43
commit e813dde02c
2 changed files with 9 additions and 0 deletions

View file

@ -76,6 +76,9 @@ GS_EXPORT NSString* const NSURLFileScheme;
+ (NSURL*) fileURLWithPathComponents: (NSArray*)components;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
+ (id) fileURLWithPath: (NSString*)aPath isDirectory: (BOOL)isDir;
#endif
/**
* Create and return a URL with the supplied string, which should
* be a string (containing percent escape codes where necessary)

View file

@ -616,6 +616,12 @@ static NSUInteger urlAlign;
return AUTORELEASE([[NSURL alloc] initFileURLWithPath: aPath]);
}
+ (id) fileURLWithPath: (NSString*)aPath isDirectory: (BOOL)isDir
{
return AUTORELEASE([[NSURL alloc] initFileURLWithPath: aPath
isDirectory: isDir]);
}
+ (NSURL*) fileURLWithPathComponents: (NSArray*)components
{
return [self fileURLWithPath: [NSString pathWithComponents: components]];