mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Implement new methods.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14441 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
33589dec57
commit
9689bbaadf
3 changed files with 67 additions and 49 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2002-09-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSFileManager.m: MacOS-X ([componentsToDisplayForPath:]) and
|
||||||
|
([displayNameAtPath:]) methods imnplemented.
|
||||||
|
|
||||||
2002-09-13 Adam Fedor <fedor@gnu.org>
|
2002-09-13 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* Source/cifframe.m (cifframe_guess_struct_size): Recurse if
|
* Source/cifframe.m (cifframe_guess_struct_size): Recurse if
|
||||||
|
|
|
@ -47,65 +47,51 @@
|
||||||
NSString *_lastError;
|
NSString *_lastError;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getting the default manager
|
|
||||||
+ (NSFileManager*) defaultManager;
|
+ (NSFileManager*) defaultManager;
|
||||||
|
|
||||||
// Directory operations
|
|
||||||
- (BOOL) changeCurrentDirectoryPath: (NSString*)path;
|
- (BOOL) changeCurrentDirectoryPath: (NSString*)path;
|
||||||
|
- (BOOL) changeFileAttributes: (NSDictionary*)attributes
|
||||||
|
atPath: (NSString*)path;
|
||||||
|
- (NSArray*) componentsToDisplayForPath: (NSString*)path;
|
||||||
|
- (NSData*) contentsAtPath: (NSString*)path;
|
||||||
|
- (BOOL) contentsEqualAtPath: (NSString*)path1
|
||||||
|
andPath: (NSString*)path2;
|
||||||
|
- (BOOL) copyPath: (NSString*)source
|
||||||
|
toPath: (NSString*)destination
|
||||||
|
handler: (id)handler;
|
||||||
- (BOOL) createDirectoryAtPath: (NSString*)path
|
- (BOOL) createDirectoryAtPath: (NSString*)path
|
||||||
attributes: (NSDictionary*)attributes;
|
attributes: (NSDictionary*)attributes;
|
||||||
|
- (BOOL) createFileAtPath: (NSString*)path
|
||||||
|
contents: (NSData*)contents
|
||||||
|
attributes: (NSDictionary*)attributes;
|
||||||
|
- (BOOL) createSymbolicLinkAtPath: (NSString*)path
|
||||||
|
pathContent: (NSString*)otherPath;
|
||||||
- (NSString*) currentDirectoryPath;
|
- (NSString*) currentDirectoryPath;
|
||||||
|
- (NSArray*) directoryContentsAtPath: (NSString*)path;
|
||||||
// File operations
|
- (NSString*) displayNameAtPath: (NSString*)path;
|
||||||
- (BOOL) copyPath: (NSString*)source
|
- (NSDirectoryEnumerator*) enumeratorAtPath: (NSString*)path;
|
||||||
|
- (NSDictionary*) fileAttributesAtPath: (NSString*)path
|
||||||
|
traverseLink: (BOOL)flag;
|
||||||
|
- (BOOL) fileExistsAtPath: (NSString*)path;
|
||||||
|
- (BOOL) fileExistsAtPath: (NSString*)path isDirectory: (BOOL*)isDirectory;
|
||||||
|
- (NSDictionary*) fileSystemAttributesAtPath: (NSString*)path;
|
||||||
|
- (const char*) fileSystemRepresentationWithPath: (NSString*)path;
|
||||||
|
- (BOOL) isExecutableFileAtPath: (NSString*)path;
|
||||||
|
- (BOOL) isDeletableFileAtPath: (NSString*)path;
|
||||||
|
- (BOOL) isReadableFileAtPath: (NSString*)path;
|
||||||
|
- (BOOL) isWritableFileAtPath: (NSString*)path;
|
||||||
|
- (BOOL) linkPath: (NSString*)source
|
||||||
toPath: (NSString*)destination
|
toPath: (NSString*)destination
|
||||||
handler: (id)handler;
|
handler: (id)handler;
|
||||||
- (BOOL) movePath: (NSString*)source
|
- (BOOL) movePath: (NSString*)source
|
||||||
toPath: (NSString*)destination
|
toPath: (NSString*)destination
|
||||||
handler: (id)handler;
|
handler: (id)handler;
|
||||||
- (BOOL) linkPath: (NSString*)source
|
- (NSString*) pathContentOfSymbolicLinkAtPath: (NSString*)path;
|
||||||
toPath: (NSString*)destination
|
|
||||||
handler: (id)handler;
|
|
||||||
- (BOOL) removeFileAtPath: (NSString*)path
|
- (BOOL) removeFileAtPath: (NSString*)path
|
||||||
handler: (id)handler;
|
handler: (id)handler;
|
||||||
- (BOOL) createFileAtPath: (NSString*)path
|
|
||||||
contents: (NSData*)contents
|
|
||||||
attributes: (NSDictionary*)attributes;
|
|
||||||
|
|
||||||
// Getting and comparing file contents
|
|
||||||
- (NSData*) contentsAtPath: (NSString*)path;
|
|
||||||
- (BOOL) contentsEqualAtPath: (NSString*)path1
|
|
||||||
andPath: (NSString*)path2;
|
|
||||||
|
|
||||||
// Detemining access to files
|
|
||||||
- (BOOL) fileExistsAtPath: (NSString*)path;
|
|
||||||
- (BOOL) fileExistsAtPath: (NSString*)path isDirectory: (BOOL*)isDirectory;
|
|
||||||
- (BOOL) isReadableFileAtPath: (NSString*)path;
|
|
||||||
- (BOOL) isWritableFileAtPath: (NSString*)path;
|
|
||||||
- (BOOL) isExecutableFileAtPath: (NSString*)path;
|
|
||||||
- (BOOL) isDeletableFileAtPath: (NSString*)path;
|
|
||||||
|
|
||||||
// Getting and setting attributes
|
|
||||||
- (NSDictionary*) fileAttributesAtPath: (NSString*)path
|
|
||||||
traverseLink: (BOOL)flag;
|
|
||||||
- (NSDictionary*) fileSystemAttributesAtPath: (NSString*)path;
|
|
||||||
- (BOOL) changeFileAttributes: (NSDictionary*)attributes
|
|
||||||
atPath: (NSString*)path;
|
|
||||||
|
|
||||||
// Discovering directory contents
|
|
||||||
- (NSArray*) directoryContentsAtPath: (NSString*)path;
|
|
||||||
- (NSDirectoryEnumerator*) enumeratorAtPath: (NSString*)path;
|
|
||||||
- (NSArray*) subpathsAtPath: (NSString*)path;
|
|
||||||
|
|
||||||
// Symbolic-link operations
|
|
||||||
- (BOOL) createSymbolicLinkAtPath: (NSString*)path
|
|
||||||
pathContent: (NSString*)otherPath;
|
|
||||||
- (NSString*) pathContentOfSymbolicLinkAtPath: (NSString*)path;
|
|
||||||
|
|
||||||
// Converting file-system representations
|
|
||||||
- (const char*) fileSystemRepresentationWithPath: (NSString*)path;
|
|
||||||
- (NSString*) stringWithFileSystemRepresentation: (const char*)string
|
- (NSString*) stringWithFileSystemRepresentation: (const char*)string
|
||||||
length: (unsigned int)len;
|
length: (unsigned int)len;
|
||||||
|
- (NSArray*) subpathsAtPath: (NSString*)path;
|
||||||
|
|
||||||
@end /* NSFileManager */
|
@end /* NSFileManager */
|
||||||
|
|
||||||
|
@ -132,17 +118,13 @@
|
||||||
} _flags;
|
} _flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initializing
|
|
||||||
- (id) initWithDirectoryPath: (NSString*)path
|
- (id) initWithDirectoryPath: (NSString*)path
|
||||||
recurseIntoSubdirectories: (BOOL)recurse
|
recurseIntoSubdirectories: (BOOL)recurse
|
||||||
followSymlinks: (BOOL)follow
|
followSymlinks: (BOOL)follow
|
||||||
justContents: (BOOL)justContents;
|
justContents: (BOOL)justContents;
|
||||||
|
|
||||||
// Getting attributes
|
|
||||||
- (NSDictionary*) directoryAttributes;
|
- (NSDictionary*) directoryAttributes;
|
||||||
- (NSDictionary*) fileAttributes;
|
- (NSDictionary*) fileAttributes;
|
||||||
|
|
||||||
// Skipping subdirectories
|
|
||||||
- (void) skipDescendents;
|
- (void) skipDescendents;
|
||||||
|
|
||||||
@end /* NSDirectoryEnumerator */
|
@end /* NSDirectoryEnumerator */
|
||||||
|
|
|
@ -1238,8 +1238,25 @@ static NSFileManager* defaultManager = nil;
|
||||||
return allOk;
|
return allOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discovering directory contents
|
/**
|
||||||
|
* Returns an array of path components suitably modified for display
|
||||||
|
* to the end user. This modification may render the returned strings
|
||||||
|
* unusable for path manipulation, so you should work with two arrays ...
|
||||||
|
* one returned by this method (for display tio the user), and a
|
||||||
|
* parallel one returned by [NSString-pathComponents] (for path
|
||||||
|
* manipulation).
|
||||||
|
*/
|
||||||
|
- (NSArray*) componentsToDisplayForPath: (NSString*)path
|
||||||
|
{
|
||||||
|
return [path pathComponents];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of the contents of the specified directory.<br />
|
||||||
|
* The listing does <strong>not</strong> recursively list subdirectories.<br />
|
||||||
|
* The special files '.' and '..' are not listed.<br />
|
||||||
|
* Returns nil if path is not a directory (or it can't be read for some reason).
|
||||||
|
*/
|
||||||
- (NSArray*) directoryContentsAtPath: (NSString*)path
|
- (NSArray*) directoryContentsAtPath: (NSString*)path
|
||||||
{
|
{
|
||||||
NSDirectoryEnumerator *direnum;
|
NSDirectoryEnumerator *direnum;
|
||||||
|
@ -1277,6 +1294,20 @@ static NSFileManager* defaultManager = nil;
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the file or directory at path. Converts it into
|
||||||
|
* a format for display to an end user. This may render it unusable as
|
||||||
|
* part of a file/path name.<br />
|
||||||
|
* For instance, if a user has elected not to see file extensions, this
|
||||||
|
* method may return filenames with the extension removed.<br />
|
||||||
|
* The default operation is to return the result of calling
|
||||||
|
* [NSString-lastPathComponent] on the path.
|
||||||
|
*/
|
||||||
|
- (NSString*) displayNameAtPath: (NSString*)path
|
||||||
|
{
|
||||||
|
return [path lastPathComponent];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSDirectoryEnumerator*) enumeratorAtPath: (NSString*)path
|
- (NSDirectoryEnumerator*) enumeratorAtPath: (NSString*)path
|
||||||
{
|
{
|
||||||
return AUTORELEASE([[NSDirectoryEnumerator alloc]
|
return AUTORELEASE([[NSDirectoryEnumerator alloc]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue