mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Merge pull request #419 from 2xsaiko/outgoing/nsfmurls
Implement -[NSFileManager URLsForDirectory:inDomains:]
This commit is contained in:
commit
92247d13c9
4 changed files with 36 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2024-06-10 Marco Rebhan <me@dblsaiko.net>
|
||||
|
||||
* Headers/Foundation/NSFileManager.h:
|
||||
* Source/NSFileManager.m:
|
||||
Implement -[NSFileManager URLsForDirectory:inDomains:].
|
||||
|
||||
2024-06-10 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSFileHandle.m: debug log of closing a closed file handle
|
||||
|
|
|
@ -356,6 +356,21 @@ GS_EXPORT_CLASS
|
|||
create: (BOOL)shouldCreate
|
||||
error: (NSError **)error;
|
||||
|
||||
/**
|
||||
* Returns an array of search paths to look at for resources.<br/ >
|
||||
* The paths are returned in domain order:
|
||||
* USER, LOCAL, NETWORK then SYSTEM.<br />
|
||||
* The presence of a path in this list does <em>not</em> mean that the
|
||||
* path actually exists in the filesystem.<br />
|
||||
* If you are wanting to locate an existing resource, you should normally
|
||||
* call this method with NSAllDomainsMask, but if you wish to find the
|
||||
* path in which you should create a new file, you would generally
|
||||
* specify a particular domain, and then create the path in the file
|
||||
* system if it does not already exist.
|
||||
*/
|
||||
- (GS_GENERIC_CLASS(NSArray, NSURL *) *)URLsForDirectory: (NSSearchPathDirectory)directory
|
||||
inDomains: (NSSearchPathDomainMask)domain;
|
||||
|
||||
/**
|
||||
* Enumerate over the contents of a directory.
|
||||
*/
|
||||
|
|
1
MISSING
1
MISSING
|
@ -180,7 +180,6 @@ NSFileManager:
|
|||
|
||||
- mountedVolumeURLsIncludingResourceValuesForKeys:options:
|
||||
- contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error:
|
||||
- URLsForDirectory:inDomains:
|
||||
- createDirectoryAtURL:withIntermediateDirectories:attributes:error:
|
||||
- createSymbolicLinkAtURL:withDestinationURL:error:
|
||||
- setDelegate:
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#import "Foundation/NSSet.h"
|
||||
#import "Foundation/NSURL.h"
|
||||
#import "Foundation/NSValue.h"
|
||||
#import "GSFastEnumeration.h"
|
||||
#import "GSPrivate.h"
|
||||
#import "GSPThread.h"
|
||||
#import "GNUstepBase/NSString+GNUstepBase.h"
|
||||
|
@ -925,6 +926,20 @@ static gs_mutex_t classLock = GS_MUTEX_INIT_STATIC;
|
|||
return [NSURL fileURLWithPath: path];
|
||||
}
|
||||
|
||||
- (GS_GENERIC_CLASS(NSArray, NSURL *) *)URLsForDirectory: (NSSearchPathDirectory)directory
|
||||
inDomains: (NSSearchPathDomainMask)domain
|
||||
{
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(directory, domain, YES);
|
||||
NSMutableArray *urls = [[NSMutableArray alloc] initWithCapacity: paths.count];
|
||||
|
||||
FOR_IN(NSString *, path, paths)
|
||||
[urls addObject: [NSURL fileURLWithPath: path]];
|
||||
END_FOR_IN(paths)
|
||||
|
||||
RELEASE(paths);
|
||||
return urls;
|
||||
}
|
||||
|
||||
- (NSDirectoryEnumerator*) enumeratorAtURL: (NSURL*)url
|
||||
includingPropertiesForKeys: (NSArray*)keys
|
||||
options: (NSDirectoryEnumerationOptions)mask
|
||||
|
|
Loading…
Reference in a new issue