10.6 sompatibility (some)

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33337 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2011-06-18 07:09:28 +00:00
parent 9212d01480
commit c1d5647bb6
3 changed files with 67 additions and 6 deletions

View file

@ -1,3 +1,8 @@
2011-06-18 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Foundation/NSURL.h:
* Source/NSURL.m: more 10.6 methods
2011-06-17 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSXMLParser.m: Fix error with whitespace at end of attributes.

View file

@ -70,6 +70,12 @@ GS_EXPORT NSString* const NSURLFileScheme;
*/
+ (id) fileURLWithPath: (NSString*)aPath;
#if OS_API_VERSION(100600,GS_API_LATEST)
/** Creates a file URL using a path built from components.
*/
+ (NSURL*) fileURLWithPathComponents: (NSArray*)components;
#endif
/**
* Create and return a URL with the supplied string, which should
* be a string (containing percent escape codes where necessary)
@ -253,8 +259,14 @@ GS_EXPORT NSString* const NSURLFileScheme;
- (NSString*) path;
#if OS_API_VERSION(100600,GS_API_LATEST)
/** Returns thepath components of the receiver.<br />
* See [NSString-pathComponents].
*/
- (NSArray*) pathComponents;
/** Returns the file extension (text after the rightmost dot in the path)
* of the receiver.
* of the receiver.<br />
* see [NSString-pathExtension].
*/
- (NSString*) pathExtension;
#endif
@ -334,24 +346,39 @@ GS_EXPORT NSString* const NSURLFileScheme;
#if OS_API_VERSION(100600,GS_API_LATEST)
/** Returns a URL formed by adding a path component to the path of the
* receiver.
* receiver.<br />
* See [NSString-stringByAppendingPathComponent:].
*/
- (NSURL*) URLByAppendingPathComponent: (NSString*)pathComponent;
/** Returns a URL formed by adding a path extension to the path of the
* receiver.
* receiver.<br />
* See [NSString-stringByAppendingPathExtension:].
*/
- (NSURL*) URLByAppendingPathExtension: (NSString*)pathExtension;
/** Returns a URL formed by removing a path component from the path of the
* receiver.
* receiver.<br />
* See [NSString-stringByDeletingLastPathComponent].
*/
- (NSURL*) URLByDeletingLastPathComponent;
/** Returns a URL formed by removing an extension from the path of the
* receiver.
* receiver.<br />
* See [NSString-stringByDeletingPathExtension].
*/
- (NSURL*) URLByDeletingPathExtension;
/** Returns self unless the receiver is a file URL, in which case it returns
* a URL formed by calling [NSString-stringByResolvingSymlinksInPath].
*/
- (NSURL*) URLByResolvingSymlinksInPath;
/** Returns self unless the receiver is a file URL, in which case it returns
* a URL formed by calling [NSString-stringByStandardizingPath].
*/
- (NSURL*) URLByStandardizingPath;
#endif
/**

View file

@ -609,6 +609,11 @@ static NSUInteger urlAlign;
return AUTORELEASE([[NSURL alloc] initFileURLWithPath: aPath]);
}
+ (NSURL*) fileURLWithPathComponents: (NSArray*)components
{
return [self fileURLWithPath: [NSString pathWithComponents: components]];
}
+ (void) initialize
{
if (clientsLock == nil)
@ -1622,6 +1627,11 @@ static NSUInteger urlAlign;
return path;
}
- (NSArray*) pathComponents
{
return [[self path] pathComponents];
}
- (NSString*) pathExtension
{
return [[self path] pathExtension];
@ -1834,7 +1844,7 @@ static NSUInteger urlAlign;
- (NSURL*) URLByAppendingPathComponent: (NSString*)pathComponent
{
return [self _URLBySettingPath:
[[self path] stringByAppendingPathComponent:pathComponent]];
[[self path] stringByAppendingPathComponent: pathComponent]];
}
- (NSURL*) URLByAppendingPathExtension: (NSString*)pathExtension
@ -1855,6 +1865,25 @@ static NSUInteger urlAlign;
[[self path] stringByDeletingPathExtension]];
}
- (NSURL*) URLByResolvingSymlinksInPath
{
if ([self isFileURL])
{
return [NSURL fileURLWithPath:
[[self path] stringByResolvingSymlinksInPath]];
}
return self;
}
- (NSURL*) URLByStandardizingPath
{
if ([self isFileURL])
{
return [NSURL fileURLWithPath: [[self path] stringByStandardizingPath]];
}
return self;
}
- (void) URLHandle: (NSURLHandle*)sender
resourceDataDidBecomeAvailable: (NSData*)newData
{