mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Fix non-portabe use of dot syntax. Fix excess release. Conform to coding style.
This commit is contained in:
parent
92247d13c9
commit
a4b661d633
1 changed files with 21 additions and 18 deletions
|
@ -893,13 +893,13 @@ static gs_mutex_t classLock = GS_MUTEX_INIT_STATIC;
|
|||
return result;
|
||||
}
|
||||
|
||||
- (NSURL *)URLForDirectory: (NSSearchPathDirectory)directory
|
||||
- (NSURL*) URLForDirectory: (NSSearchPathDirectory)directory
|
||||
inDomain: (NSSearchPathDomainMask)domain
|
||||
appropriateForURL: (NSURL *)url
|
||||
appropriateForURL: (NSURL*)url
|
||||
create: (BOOL)shouldCreate
|
||||
error: (NSError **)error
|
||||
error: (NSError**)error
|
||||
{
|
||||
NSString *path = nil;
|
||||
NSString *path = nil;
|
||||
|
||||
if (directory == NSItemReplacementDirectory)
|
||||
{
|
||||
|
@ -907,7 +907,9 @@ static gs_mutex_t classLock = GS_MUTEX_INIT_STATIC;
|
|||
}
|
||||
else
|
||||
{
|
||||
NSArray *pathArray = NSSearchPathForDirectoriesInDomains(directory, domain, YES);
|
||||
NSArray *pathArray;
|
||||
|
||||
pathArray = NSSearchPathForDirectoriesInDomains(directory, domain, YES);
|
||||
|
||||
if ([pathArray count] > 0)
|
||||
{
|
||||
|
@ -916,27 +918,28 @@ static gs_mutex_t classLock = GS_MUTEX_INIT_STATIC;
|
|||
}
|
||||
|
||||
if (shouldCreate && ![self fileExistsAtPath: path])
|
||||
{
|
||||
[self createDirectoryAtPath: path
|
||||
withIntermediateDirectories: YES
|
||||
attributes: nil
|
||||
error: error];
|
||||
}
|
||||
{
|
||||
[self createDirectoryAtPath: path
|
||||
withIntermediateDirectories: YES
|
||||
attributes: nil
|
||||
error: error];
|
||||
}
|
||||
|
||||
return [NSURL fileURLWithPath: path];
|
||||
}
|
||||
|
||||
- (GS_GENERIC_CLASS(NSArray, NSURL *) *)URLsForDirectory: (NSSearchPathDirectory)directory
|
||||
inDomains: (NSSearchPathDomainMask)domain
|
||||
- (GS_GENERIC_CLASS(NSArray, NSURL*)*)
|
||||
URLsForDirectory: (NSSearchPathDirectory)directory
|
||||
inDomains: (NSSearchPathDomainMask)domain
|
||||
{
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(directory, domain, YES);
|
||||
NSMutableArray *urls = [[NSMutableArray alloc] initWithCapacity: paths.count];
|
||||
NSArray *paths;
|
||||
NSMutableArray *urls;
|
||||
|
||||
FOR_IN(NSString *, path, paths)
|
||||
paths = NSSearchPathForDirectoriesInDomains(directory, domain, YES);
|
||||
urls = [[NSMutableArray alloc] initWithCapacity: [paths count]];
|
||||
FOR_IN(NSString*, path, paths)
|
||||
[urls addObject: [NSURL fileURLWithPath: path]];
|
||||
END_FOR_IN(paths)
|
||||
|
||||
RELEASE(paths);
|
||||
return urls;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue