mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Make the use of nil for a file URL path raise an invalid argument exception
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33939 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
49c91de79d
commit
aae4782eb3
4 changed files with 33 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
|||
2011-10-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/Foundation/NSURL.h: Document that methods creating file URLs
|
||||
raise an exception on being given a nil argument.
|
||||
* Source/NSURL.m: Make file URL initialisers raise on nil argument.
|
||||
* Source/NSBundle.m: Fix to check for nil path when reating file
|
||||
URLs (fix for bug #34468).
|
||||
|
||||
2011-10-03 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSPropertyList.m (GSBinaryPLParser -objectAtIndex:): Use
|
||||
|
|
|
@ -96,6 +96,7 @@ GS_EXPORT NSString* const NSURLFileScheme;
|
|||
/**
|
||||
* Initialise as a file URL with the specified path (which must
|
||||
* be a valid path on the local filesystem).<br />
|
||||
* Raises NSInvalidArgumentException if aPath is nil.<br />
|
||||
* Converts relative paths to absolute ones.<br />
|
||||
* Appends a trailing slash to the path when necessary if it
|
||||
* specifies a directory.<br />
|
||||
|
@ -107,6 +108,7 @@ GS_EXPORT NSString* const NSURLFileScheme;
|
|||
/**
|
||||
* Initialise as a file URL with the specified path (which must
|
||||
* be a valid path on the local filesystem).<br />
|
||||
* Raises NSInvalidArgumentException if aPath is nil.<br />
|
||||
* Converts relative paths to absolute ones.<br />
|
||||
* Appends a trailing slash to the path when necessary if it
|
||||
* specifies a directory.<br />
|
||||
|
|
|
@ -1899,10 +1899,17 @@ IF_NO_GC(
|
|||
subdirectory: (NSString *)subpath
|
||||
localization: (NSString *)localizationName
|
||||
{
|
||||
return [NSURL fileURLWithPath: [self pathForResource: name
|
||||
ofType: ext
|
||||
inDirectory: subpath
|
||||
forLocalization: localizationName]];
|
||||
NSString *path;
|
||||
|
||||
path = [self pathForResource: name
|
||||
ofType: ext
|
||||
inDirectory: subpath
|
||||
forLocalization: localizationName];
|
||||
if (nil == path)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
return [NSURL fileURLWithPath: path];
|
||||
}
|
||||
|
||||
+ (NSArray*) _pathsForResourcesOfType: (NSString*)extension
|
||||
|
|
|
@ -640,6 +640,12 @@ static NSUInteger urlAlign;
|
|||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
BOOL flag = NO;
|
||||
|
||||
if (nil == aPath)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"[%@ %@] nil string parameter",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
||||
}
|
||||
if ([aPath isAbsolutePath] == NO)
|
||||
{
|
||||
aPath = [[mgr currentDirectoryPath]
|
||||
|
@ -667,6 +673,12 @@ static NSUInteger urlAlign;
|
|||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
BOOL flag = NO;
|
||||
|
||||
if (nil == aPath)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"[%@ %@] nil string parameter",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
||||
}
|
||||
if ([aPath isAbsolutePath] == NO)
|
||||
{
|
||||
aPath = [[mgr currentDirectoryPath]
|
||||
|
|
Loading…
Reference in a new issue