21 #import "OFDictionary.h"
23 OF_ASSUME_NONNULL_BEGIN
28 # if (defined(OF_HAVE_CHMOD) && !defined(OF_AMIGAOS)) || defined(DOXYGEN)
29 # define OF_FILE_MANAGER_SUPPORTS_PERMISSIONS
31 # if (defined(OF_HAVE_CHOWN) && !defined(OF_AMIGAOS)) || defined(DOXYGEN)
32 # define OF_FILE_MANAGER_SUPPORTS_OWNER
34 # if (defined(OF_HAVE_LINK) && !defined(OF_AMIGAOS) && !defined(OF_HAIKU)) || \
35 defined(OF_WINDOWS) || defined(DOXYGEN)
36 # define OF_FILE_MANAGER_SUPPORTS_LINKS
38 # if (defined(OF_HAVE_SYMLINK) && !defined(OF_AMIGAOS)) || \
39 defined(OF_WINDOWS) || defined(DOXYGEN)
40 # define OF_FILE_MANAGER_SUPPORTS_SYMLINKS
42 # if defined(OF_LINUX) || defined(OF_MACOS) || defined(OF_FREEBSD) || \
43 defined(OF_NETBSD) || defined(OF_HAIKU) || defined(OF_SOLARIS) || \
45 # define OF_FILE_MANAGER_SUPPORTS_EXTENDED_ATTRIBUTES
49 @class OFArray OF_GENERIC(ObjectType);
272 #ifndef OF_FILE_MANAGER_M
273 OF_SUBCLASSING_RESTRICTED
276 #ifdef OF_HAVE_CLASS_PROPERTIES
369 - (bool)fileExistsAtPath: (
OFString *)path;
380 - (bool)fileExistsAtIRI: (
OFIRI *)IRI;
389 - (bool)directoryExistsAtPath: (
OFString *)path;
400 - (bool)directoryExistsAtIRI: (
OFIRI *)IRI;
409 - (void)createDirectoryAtPath: (
OFString *)path;
419 - (void)createDirectoryAtPath: (
OFString *)path
420 createParents: (
bool)createParents;
431 - (void)createDirectoryAtIRI: (
OFIRI *)IRI;
443 - (void)createDirectoryAtIRI: (
OFIRI *)IRI createParents: (
bool)createParents;
493 - (void)changeCurrentDirectoryPath: (
OFString *)path;
502 - (void)changeCurrentDirectoryIRI: (
OFIRI *)IRI;
541 - (void)copyItemAtIRI: (
OFIRI *)source toIRI: (
OFIRI *)destination;
591 - (void)moveItemAtIRI: (
OFIRI *)source toIRI: (
OFIRI *)destination;
602 - (void)removeItemAtPath: (
OFString *)path;
615 - (void)removeItemAtIRI: (
OFIRI *)IRI;
617 #ifdef OF_FILE_MANAGER_SUPPORTS_LINKS
651 - (void)linkItemAtIRI: (
OFIRI *)source toIRI: (
OFIRI *)destination;
653 #ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS
671 - (void)createSymbolicLinkAtPath: (
OFString *)path
672 withDestinationPath: (
OFString *)target;
692 - (void)createSymbolicLinkAtIRI: (
OFIRI *)IRI
693 withDestinationPath: (
OFString *)target;
695 #ifdef OF_FILE_MANAGER_SUPPORTS_EXTENDED_ATTRIBUTES
733 - (void)getExtendedAttributeData: (
OFData *_Nonnull *_Nonnull)data
734 andType: (
id _Nullable *_Nullable)type
757 ofItemAtIRI: (
OFIRI *)IRI;
780 - (void)getExtendedAttributeData: (
OFData *_Nonnull *_Nonnull)data
781 andType: (
id _Nullable *_Nullable)type
783 ofItemAtIRI: (
OFIRI *)IRI;
785 #ifdef OF_FILE_MANAGER_SUPPORTS_EXTENDED_ATTRIBUTES
800 - (void)setExtendedAttributeData: (
OFData *)data
823 - (void)setExtendedAttributeData: (
OFData *)data
824 andType: (nullable
id)type
845 - (void)setExtendedAttributeData: (
OFData *)data
847 ofItemAtIRI: (
OFIRI *)IRI;
870 - (void)setExtendedAttributeData: (
OFData *)data
871 andType: (nullable
id)type
873 ofItemAtIRI: (
OFIRI *)IRI;
875 #ifdef OF_FILE_MANAGER_SUPPORTS_EXTENDED_ATTRIBUTES
889 - (void)removeExtendedAttributeForName: (
OFString *)name
908 - (void)removeExtendedAttributeForName: (
OFString *)name
909 ofItemAtIRI: (
OFIRI *)IRI;
912 @interface OFDictionary (FileAttributes)
918 @property (readonly, nonatomic)
unsigned long long fileSize;
932 @property (readonly, nonatomic)
unsigned long filePOSIXPermissions;
939 @property (readonly, nonatomic)
unsigned long fileOwnerAccountID;
946 @property (readonly, nonatomic)
unsigned long fileGroupOwnerAccountID;
953 @property (readonly, nonatomic)
OFString *fileOwnerAccountName;
960 @property (readonly, nonatomic)
OFString *fileGroupOwnerAccountName;
967 @property (readonly, nonatomic)
OFDate *fileLastAccessDate;
974 @property (readonly, nonatomic)
OFDate *fileModificationDate;
981 @property (readonly, nonatomic)
OFDate *fileStatusChangeDate;
988 @property (readonly, nonatomic)
OFDate *fileCreationDate;
995 @property (readonly, nonatomic)
OFString *fileSymbolicLinkDestination;
1002 @property (readonly, nonatomic)
1006 OF_ASSUME_NONNULL_END
const OFFileAttributeType OFFileTypeFIFO
A FIFO.
const OFFileAttributeKey OFFileCreationDate
The creation date of the file as an OFDate.
const OFFileAttributeKey OFFileOwnerAccountName
The account name of the owner of the file as an OFString.
const OFFileAttributeKey OFFileExtendedAttributesNames
The names of the extended attributes as an OFArray of OFString.
const OFFileAttributeKey OFFilePOSIXPermissions
The POSIX permissions of the file as an OFNumber.
OFConstantString * OFFileAttributeType
The type of a file.
Definition: OFFileManager.h:94
const OFFileAttributeType OFFileTypeBlockSpecial
A block special file.
const OFFileAttributeKey OFFileGroupOwnerAccountID
The account ID of the group owner of the file as an OFNumber.
const OFFileAttributeKey OFFileGroupOwnerAccountName
The account name of the group owner of the file as an OFString.
const OFFileAttributeType OFFileTypeSocket
A socket.
const OFFileAttributeKey OFFileStatusChangeDate
The last status change date of the file as an OFDate.
OFConstantString * OFFileAttributeKey
A key for a file attribute in the file attributes dictionary.
Definition: OFFileManager.h:53
OFMutableDictionary * OFMutableFileAttributes
A mutable dictionary mapping keys of type OFFileAttributeKey to their attribute values.
Definition: OFFileManager.h:107
const OFFileAttributeType OFFileTypeRegular
A regular file.
const OFFileAttributeKey OFFileSymbolicLinkDestination
The destination of a symbolic link as an OFString.
const OFFileAttributeKey OFFileType
The type of the file.
const OFFileAttributeKey OFFileModificationDate
The last modification date of the file as an OFDate.
const OFFileAttributeType OFFileTypeCharacterSpecial
A character special file.
const OFFileAttributeKey OFFileSize
The size of the file as an OFNumber.
const OFFileAttributeType OFFileTypeSymbolicLink
A symbolic link.
const OFFileAttributeKey OFFileOwnerAccountID
The account ID of the owner of the file as an OFNumber.
const OFFileAttributeType OFFileTypeUnknown
An unknown file type.
OFDictionary * OFFileAttributes
A dictionary mapping keys of type OFFileAttributeKey to their attribute values.
Definition: OFFileManager.h:100
const OFFileAttributeKey OFFileLastAccessDate
The last access date of the file as an OFDate.
const OFFileAttributeType OFFileTypeDirectory
A directory.
An abstract class for storing objects in an array.
Definition: OFArray.h:109
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:42
A class for storing arbitrary data in an array.
Definition: OFData.h:46
A class for storing, accessing and comparing dates.
Definition: OFDate.h:34
An abstract class for storing objects in a dictionary.
Definition: OFDictionary.h:84
A class which provides management for files, e.g. reading contents of directories,...
Definition: OFFileManager.h:276
OFFileManager * defaultManager()
Returns the default file manager.
Definition: OFFileManager.m:136
OFIRI * currentDirectoryIRI
The IRI of the current working directory.
Definition: OFFileManager.h:293
OFString * currentDirectoryPath
The path of the current working directory.
Definition: OFFileManager.h:286
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition: OFIRI.h:41
An abstract class for storing and changing objects in a dictionary.
Definition: OFMutableDictionary.h:48
The root class for all other classes inside ObjFW.
Definition: OFObject.h:692
A class for handling strings.
Definition: OFString.h:143