mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Merge pull request #164 from triplef/add-nsfilehandle-url-methods
Add NSFileHandle URL initializers.
This commit is contained in:
commit
d27dcfbed6
4 changed files with 55 additions and 14 deletions
|
@ -32,6 +32,7 @@
|
|||
#import "Foundation/NSHost.h"
|
||||
#import "Foundation/NSFileHandle.h"
|
||||
#import "Foundation/NSPathUtilities.h"
|
||||
#import "Foundation/NSURL.h"
|
||||
#import "GNUstepBase/GSTLS.h"
|
||||
#import "GNUstepBase/NSString+GNUstepBase.h"
|
||||
#import "GSPrivate.h"
|
||||
|
@ -198,6 +199,36 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
return AUTORELEASE([o initWithNullDevice]);
|
||||
}
|
||||
|
||||
+ (id) fileHandleForReadingFromURL: (NSURL*)url error:(NSError**)error
|
||||
{
|
||||
id o = [self fileHandleForReadingAtPath: [url path]];
|
||||
if (!o && error)
|
||||
{
|
||||
*error = [NSError _last];
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
+ (id) fileHandleForWritingToURL: (NSURL*)url error:(NSError**)error
|
||||
{
|
||||
id o = [self fileHandleForWritingAtPath: [url path]];
|
||||
if (!o && error)
|
||||
{
|
||||
*error = [NSError _last];
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
+ (id) fileHandleForUpdatingURL: (NSURL*)url error:(NSError**)error
|
||||
{
|
||||
id o = [self fileHandleForUpdatingAtPath: [url path]];
|
||||
if (!o && error)
|
||||
{
|
||||
*error = [NSError _last];
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize with desc, which can point to either a regular file or
|
||||
* socket connection.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue