Index: src/OFFileManager.h ================================================================== --- src/OFFileManager.h +++ src/OFFileManager.h @@ -44,57 +44,57 @@ /** * @brief A key for a file attribute in the file attributes dictionary. * * Possible keys for file URLs are: * - * * @ref of_file_attribute_key_size - * * @ref of_file_attribute_key_type - * * @ref of_file_attribute_key_posix_permissions - * * @ref of_file_attribute_key_posix_uid - * * @ref of_file_attribute_key_posix_gid - * * @ref of_file_attribute_key_owner - * * @ref of_file_attribute_key_group - * * @ref of_file_attribute_key_last_access_date - * * @ref of_file_attribute_key_modification_date - * * @ref of_file_attribute_key_status_change_date - * * @ref of_file_attribute_key_creation_date - * * @ref of_file_attribute_key_symbolic_link_destination + * * @ref OFFileSize + * * @ref OFFileType + * * @ref OFFilePOSIXPermissions + * * @ref OFFileOwnerAccountID + * * @ref OFFileGroupOwnerAccountID + * * @ref OFFileOwnerAccountName + * * @ref OFFileGroupOwnerAccountName + * * @ref OFFileLastAccessDate + * * @ref OFFileModificationDate + * * @ref OFFileStatusChangeDate + * * @ref OFFileCreationDate + * * @ref OFFileSymbolicLinkDestination * * Other URL schemes might not have all keys and might have keys not listed. */ -typedef OFConstantString *of_file_attribute_key_t; +typedef OFConstantString *OFFileAttributeKey; /** * @brief The type of a file. * * Possibles values for file URLs are: * - * * @ref of_file_type_regular - * * @ref of_file_type_directory - * * @ref of_file_type_symbolic_link - * * @ref of_file_type_fifo - * * @ref of_file_type_character_special - * * @ref of_file_type_block_special - * * @ref of_file_type_socket + * * @ref OFFileTypeRegular + * * @ref OFFileTypeDirectory + * * @ref OFFileTypeSymbolicLink + * * @ref OFFileTypeFIFO + * * @ref OFFileTypeCharacterSpecial + * * @ref OFFileTypeBlockSpecial + * * @ref OFFileTypeSocket + * * @ref OFFileTypeUnknown * * Other URL schemes might not have all types and might have types not listed. */ -typedef OFConstantString *of_file_type_t; - -/** - * @brief A dictionary mapping keys of type @ref of_file_attribute_key_t - * to their attribute values. - */ -typedef OFDictionary OF_GENERIC(of_file_attribute_key_t, id) - *of_file_attributes_t; - -/** - * @brief A mutable dictionary mapping keys of type - * @ref of_file_attribute_key_t to their attribute values. - */ -typedef OFMutableDictionary OF_GENERIC(of_file_attribute_key_t, id) - *of_mutable_file_attributes_t; +typedef OFConstantString *OFFileAttributeType; + +/** + * @brief A dictionary mapping keys of type @ref OFFileAttributeKey to their + * attribute values. + */ +typedef OFDictionary OF_GENERIC(OFFileAttributeKey, id) *OFFileAttributes; + +/** + * @brief A mutable dictionary mapping keys of type @ref OFFileAttributeKey to + * their attribute values. + */ +typedef OFMutableDictionary OF_GENERIC(OFFileAttributeKey, id) + *OFMutableFileAttributes; #ifdef __cplusplus extern "C" { #endif /** @@ -101,137 +101,136 @@ * @brief The size of the file as an @ref OFNumber. * * For convenience, a category on @ref OFDictionary is provided to access this * via @ref OFDictionary#fileSize. */ -extern const of_file_attribute_key_t of_file_attribute_key_size; +extern const OFFileAttributeKey OFFileSize; /** * @brief The type of the file. * - * The corresponding value is of type @ref of_file_type_t. + * The corresponding value is of type @ref OFFileAttributeType. * * For convenience, a category on @ref OFDictionary is provided to access this * via @ref OFDictionary#fileType. */ -extern const of_file_attribute_key_t of_file_attribute_key_type; +extern const OFFileAttributeKey OFFileType; /** * @brief The POSIX permissions of the file as an @ref OFNumber. * * For convenience, a category on @ref OFDictionary is provided to access this * via @ref OFDictionary#filePOSIXPermissions. */ -extern const of_file_attribute_key_t of_file_attribute_key_posix_permissions; - -/** - * @brief The POSIX UID of the file as an @ref OFNumber. - * - * For convenience, a category on @ref OFDictionary is provided to access this - * via @ref OFDictionary#filePOSIXUID. - */ -extern const of_file_attribute_key_t of_file_attribute_key_posix_uid; - -/** - * @brief The POSIX GID of the file as an @ref OFNumber. - * - * For convenience, a category on @ref OFDictionary is provided to access this - * via @ref OFDictionary#filePOSIXGID. - */ -extern const of_file_attribute_key_t of_file_attribute_key_posix_gid; - -/** - * @brief The owner of the file as an OFString. - * - * For convenience, a category on @ref OFDictionary is provided to access this - * via @ref OFDictionary#fileOwner. - */ -extern const of_file_attribute_key_t of_file_attribute_key_owner; - -/** - * @brief The group of the file as an OFString. - * - * For convenience, a category on @ref OFDictionary is provided to access this - * via @ref OFDictionary#fileGroup. - */ -extern const of_file_attribute_key_t of_file_attribute_key_group; +extern const OFFileAttributeKey OFFilePOSIXPermissions; + +/** + * @brief The account ID of the owner of the file as an @ref OFNumber. + * + * For convenience, a category on @ref OFDictionary is provided to access this + * via @ref OFDictionary#fileOwnerAccountID. + */ +extern const OFFileAttributeKey OFFileOwnerAccountID; + +/** + * @brief The account ID of the group owner of the file as an @ref OFNumber. + * + * For convenience, a category on @ref OFDictionary is provided to access this + * via @ref OFDictionary#fileGroupOwnerAccountID. + */ +extern const OFFileAttributeKey OFFileGroupOwnerAccountID; + +/** + * @brief The account name of the owner of the file as an OFString. + * + * For convenience, a category on @ref OFDictionary is provided to access this + * via @ref OFDictionary#fileOwnerAccountName. + */ +extern const OFFileAttributeKey OFFileOwnerAccountName; + +/** + * @brief The account name of the group owner of the file as an OFString. + * + * For convenience, a category on @ref OFDictionary is provided to access this + * via @ref OFDictionary#fileGroupOwnerAccountName. + */ +extern const OFFileAttributeKey OFFileGroupOwnerAccountName; /** * @brief The last access date of the file as an @ref OFDate. * * For convenience, a category on @ref OFDictionary is provided to access this * via @ref OFDictionary#fileLastAccessDate. */ -extern const of_file_attribute_key_t of_file_attribute_key_last_access_date; +extern const OFFileAttributeKey OFFileLastAccessDate; /** * @brief The last modification date of the file as an @ref OFDate. * * For convenience, a category on @ref OFDictionary is provided to access this * via @ref OFDictionary#fileModificationDate. */ -extern const of_file_attribute_key_t of_file_attribute_key_modification_date; +extern const OFFileAttributeKey OFFileModificationDate; /** * @brief The last status change date of the file as an @ref OFDate. * * For convenience, a category on @ref OFDictionary is provided to access this * via @ref OFDictionary#fileStatusChangeDate. */ -extern const of_file_attribute_key_t of_file_attribute_key_status_change_date; +extern const OFFileAttributeKey OFFileStatusChangeDate; /** * @brief The creation date of the file as an @ref OFDate. * * For convenience, a category on @ref OFDictionary is provided to access this * via @ref OFDictionary#fileCreationDate. */ -extern const of_file_attribute_key_t of_file_attribute_key_creation_date; +extern const OFFileAttributeKey OFFileCreationDate; /** * @brief The destination of a symbolic link as an OFString. * * For convenience, a category on @ref OFDictionary is provided to access this * via @ref OFDictionary#fileSymbolicLinkDestination. */ -extern const of_file_attribute_key_t - of_file_attribute_key_symbolic_link_destination; +extern const OFFileAttributeKey OFFileSymbolicLinkDestination; /** * @brief A regular file. */ -extern const of_file_type_t of_file_type_regular; +extern const OFFileAttributeType OFFileTypeRegular; /** * @brief A directory. */ -extern const of_file_type_t of_file_type_directory; +extern const OFFileAttributeType OFFileTypeDirectory; /** * @brief A symbolic link. */ -extern const of_file_type_t of_file_type_symbolic_link; +extern const OFFileAttributeType OFFileTypeSymbolicLink; /** * @brief A FIFO. */ -extern const of_file_type_t of_file_type_fifo; +extern const OFFileAttributeType OFFileTypeFIFO; /** * @brief A character special file. */ -extern const of_file_type_t of_file_type_character_special; +extern const OFFileAttributeType OFFileTypeCharacterSpecial; /** * @brief A block special file. */ -extern const of_file_type_t of_file_type_block_special; +extern const OFFileAttributeType OFFileTypeBlockSpecial; /** * @brief A socket. */ -extern const of_file_type_t of_file_type_socket; +extern const OFFileAttributeType OFFileTypeSocket; #ifdef __cplusplus } #endif /** @@ -269,23 +268,23 @@ /** * @brief Returns the attributes for the item at the specified path. * * @param path The path to return the attributes for * @return A dictionary of attributes for the specified path, with the keys of - * type @ref of_file_attribute_key_t + * type @ref OFFileAttributeKey */ -- (of_file_attributes_t)attributesOfItemAtPath: (OFString *)path; +- (OFFileAttributes)attributesOfItemAtPath: (OFString *)path; #endif /** * @brief Returns the attributes for the item at the specified URL. * * @param URL The URL to return the attributes for * @return A dictionary of attributes for the specified URL, with the keys of - * type @ref of_file_attribute_key_t + * type @ref OFFileAttributeKey */ -- (of_file_attributes_t)attributesOfItemAtURL: (OFURL *)URL; +- (OFFileAttributes)attributesOfItemAtURL: (OFURL *)URL; #ifdef OF_HAVE_FILES /** * @brief Sets the attributes for the item at the specified path. * @@ -292,11 +291,11 @@ * All attributes not part of the dictionary are left unchanged. * * @param attributes The attributes to set for the specified path * @param path The path of the item to set the attributes for */ -- (void)setAttributes: (of_file_attributes_t)attributes +- (void)setAttributes: (OFFileAttributes)attributes ofItemAtPath: (OFString *)path; #endif /** * @brief Sets the attributes for the item at the specified URL. @@ -304,12 +303,11 @@ * All attributes not part of the dictionary are left unchanged. * * @param attributes The attributes to set for the specified URL * @param URL The URL of the item to set the attributes for */ -- (void)setAttributes: (of_file_attributes_t)attributes - ofItemAtURL: (OFURL *)URL; +- (void)setAttributes: (OFFileAttributes)attributes ofItemAtURL: (OFURL *)URL; #ifdef OF_HAVE_FILES /** * @brief Checks whether a file exists at the specified path. * @@ -564,95 +562,90 @@ withDestinationPath: (OFString *)target; @end @interface OFDictionary (FileAttributes) /** - * @brief The @ref of_file_attribute_key_size key from the dictionary. + * @brief The @ref OFFileSize key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) unsigned long long fileSize; /** - * @brief The @ref of_file_attribute_key_type key from the dictionary. + * @brief The @ref OFFileType key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ -@property (readonly, nonatomic) of_file_type_t fileType; +@property (readonly, nonatomic) OFFileAttributeType fileType; /** - * @brief The @ref of_file_attribute_key_posix_permissions key from the - * dictionary. + * @brief The @ref OFFilePOSIXPermissions key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) unsigned long filePOSIXPermissions; /** - * @brief The @ref of_file_attribute_key_posix_uid key from the dictionary. - * - * Raises an @ref OFUndefinedKeyException if the key is missing. - */ -@property (readonly, nonatomic) unsigned long filePOSIXUID; - -/** - * @brief The @ref of_file_attribute_key_posix_gid key from the dictionary. - * - * Raises an @ref OFUndefinedKeyException if the key is missing. - */ -@property (readonly, nonatomic) unsigned long filePOSIXGID; - -/** - * @brief The @ref of_file_attribute_key_owner key from the dictionary. - * - * Raises an @ref OFUndefinedKeyException if the key is missing. - */ -@property (readonly, nonatomic) OFString *fileOwner; - -/** - * @brief The @ref of_file_attribute_key_group key from the dictionary. - * - * Raises an @ref OFUndefinedKeyException if the key is missing. - */ -@property (readonly, nonatomic) OFString *fileGroup; - -/** - * @brief The @ref of_file_attribute_key_last_access_date key from the - * dictionary. + * @brief The @ref OFFileOwnerAccountID key from the dictionary. + * + * Raises an @ref OFUndefinedKeyException if the key is missing. + */ +@property (readonly, nonatomic) unsigned long fileOwnerAccountID; + +/** + * @brief The @ref OFFileGroupOwnerAccountID key from the dictionary. + * + * Raises an @ref OFUndefinedKeyException if the key is missing. + */ +@property (readonly, nonatomic) unsigned long fileGroupOwnerAccountID; + +/** + * @brief The @ref OFFileOwnerAccountName key from the dictionary. + * + * Raises an @ref OFUndefinedKeyException if the key is missing. + */ +@property (readonly, nonatomic) OFString *fileOwnerAccountName; + +/** + * @brief The @ref OFFileGroupOwnerAccountName key from the dictionary. + * + * Raises an @ref OFUndefinedKeyException if the key is missing. + */ +@property (readonly, nonatomic) OFString *fileGroupOwnerAccountName; + +/** + * @brief The @ref OFFileLastAccessDate key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) OFDate *fileLastAccessDate; /** - * @brief The @ref of_file_attribute_key_modification_date key from the - * dictionary. + * @brief The @ref OFFileModificationDate key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) OFDate *fileModificationDate; /** - * @brief The @ref of_file_attribute_key_status_change_date key from the - * dictionary. + * @brief The @ref OFFileStatusChangeDate key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) OFDate *fileStatusChangeDate; /** - * @brief The @ref of_file_attribute_key_creation_date key from the dictionary. + * @brief The @ref OFFileCreationDate key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) OFDate *fileCreationDate; /** - * @brief The @ref of_file_attribute_key_symbolic_link_destination key from the - * dictionary. + * @brief The @ref OFFileSymbolicLinkDestination key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) OFString *fileSymbolicLinkDestination; @end OF_ASSUME_NONNULL_END Index: src/OFFileManager.m ================================================================== --- src/OFFileManager.m +++ src/OFFileManager.m @@ -69,43 +69,34 @@ #endif @interface OFDefaultFileManager: OFFileManager @end -const of_file_attribute_key_t of_file_attribute_key_size = - @"of_file_attribute_key_size"; -const of_file_attribute_key_t of_file_attribute_key_type = - @"of_file_attribute_key_type"; -const of_file_attribute_key_t of_file_attribute_key_posix_permissions = - @"of_file_attribute_key_posix_permissions"; -const of_file_attribute_key_t of_file_attribute_key_posix_uid = - @"of_file_attribute_key_posix_uid"; -const of_file_attribute_key_t of_file_attribute_key_posix_gid = - @"of_file_attribute_key_posix_gid"; -const of_file_attribute_key_t of_file_attribute_key_owner = - @"of_file_attribute_key_owner"; -const of_file_attribute_key_t of_file_attribute_key_group = - @"of_file_attribute_key_group"; -const of_file_attribute_key_t of_file_attribute_key_last_access_date = - @"of_file_attribute_key_last_access_date"; -const of_file_attribute_key_t of_file_attribute_key_modification_date = - @"of_file_attribute_key_modification_date"; -const of_file_attribute_key_t of_file_attribute_key_status_change_date = - @"of_file_attribute_key_status_change_date"; -const of_file_attribute_key_t of_file_attribute_key_creation_date = - @"of_file_attribute_key_creation_date"; -const of_file_attribute_key_t of_file_attribute_key_symbolic_link_destination = - @"of_file_attribute_key_symbolic_link_destination"; - -const of_file_type_t of_file_type_regular = @"of_file_type_regular"; -const of_file_type_t of_file_type_directory = @"of_file_type_directory"; -const of_file_type_t of_file_type_symbolic_link = @"of_file_type_symbolic_link"; -const of_file_type_t of_file_type_fifo = @"of_file_type_fifo"; -const of_file_type_t of_file_type_character_special = - @"of_file_type_character_special"; -const of_file_type_t of_file_type_block_special = @"of_file_type_block_special"; -const of_file_type_t of_file_type_socket = @"of_file_type_socket"; +const OFFileAttributeKey OFFileSize = @"OFFileSize"; +const OFFileAttributeKey OFFileType = @"OFFileType"; +const OFFileAttributeKey OFFilePOSIXPermissions = @"OFFilePOSIXPermissions"; +const OFFileAttributeKey OFFileOwnerAccountID = @"OFFileOwnerAccountID"; +const OFFileAttributeKey OFFileGroupOwnerAccountID = + @"OFFileGroupOwnerAccountID"; +const OFFileAttributeKey OFFileOwnerAccountName = @"OFFileOwnerAccountName"; +const OFFileAttributeKey OFFileGroupOwnerAccountName = + @"OFFileGroupOwnerAccountName"; +const OFFileAttributeKey OFFileLastAccessDate = @"OFFileLastAccessDate"; +const OFFileAttributeKey OFFileModificationDate = @"OFFileModificationDate"; +const OFFileAttributeKey OFFileStatusChangeDate = @"OFFileStatusChangeDate"; +const OFFileAttributeKey OFFileCreationDate = @"OFFileCreationDate"; +const OFFileAttributeKey OFFileSymbolicLinkDestination = + @"OFFileSymbolicLinkDestination"; + +const OFFileAttributeType OFFileTypeRegular = @"OFFileTypeRegular"; +const OFFileAttributeType OFFileTypeDirectory = @"OFFileTypeDirectory"; +const OFFileAttributeType OFFileTypeSymbolicLink = @"OFFileTypeSymbolicLink"; +const OFFileAttributeType OFFileTypeFIFO = @"OFFileTypeFIFO"; +const OFFileAttributeType OFFileTypeCharacterSpecial = + @"OFFileTypeCharacterSpecial"; +const OFFileAttributeType OFFileTypeBlockSpecial = @"OFFileTypeBlockSpecial"; +const OFFileAttributeType OFFileTypeSocket = @"OFFileTypeSocket"; #ifdef OF_AMIGAOS4 # define CurrentDir(lock) SetCurrentDir(lock) #endif @@ -121,12 +112,11 @@ UnLock(CurrentDir(originalDirLock)); } #endif static id -attributeForKeyOrException(of_file_attributes_t attributes, - of_file_attribute_key_t key) +attributeForKeyOrException(OFFileAttributes attributes, OFFileAttributeKey key) { id object = [attributes objectForKey: key]; if (object == nil) @throw [OFUndefinedKeyException exceptionWithObject: attributes @@ -229,11 +219,11 @@ objc_autoreleasePoolPop(pool); return [ret autorelease]; } #endif -- (of_file_attributes_t)attributesOfItemAtURL: (OFURL *)URL +- (OFFileAttributes)attributesOfItemAtURL: (OFURL *)URL { OFURLHandler *URLHandler; if (URL == nil) @throw [OFInvalidArgumentException exception]; @@ -243,14 +233,14 @@ return [URLHandler attributesOfItemAtURL: URL]; } #ifdef OF_HAVE_FILES -- (of_file_attributes_t)attributesOfItemAtPath: (OFString *)path +- (OFFileAttributes)attributesOfItemAtPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); - of_file_attributes_t ret; + OFFileAttributes ret; ret = [self attributesOfItemAtURL: [OFURL fileURLWithPath: path]]; [ret retain]; @@ -258,12 +248,11 @@ return [ret autorelease]; } #endif -- (void)setAttributes: (of_file_attributes_t)attributes - ofItemAtURL: (OFURL *)URL +- (void)setAttributes: (OFFileAttributes)attributes ofItemAtURL: (OFURL *)URL { OFURLHandler *URLHandler; if (URL == nil) @throw [OFInvalidArgumentException exception]; @@ -273,11 +262,11 @@ [URLHandler setAttributes: attributes ofItemAtURL: URL]; } #ifdef OF_HAVE_FILES -- (void)setAttributes: (of_file_attributes_t)attributes +- (void)setAttributes: (OFFileAttributes)attributes ofItemAtPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); [self setAttributes: attributes ofItemAtURL: [OFURL fileURLWithPath: path]]; @@ -567,12 +556,12 @@ - (void)copyItemAtURL: (OFURL *)source toURL: (OFURL *)destination { void *pool; OFURLHandler *URLHandler; - of_file_attributes_t attributes; - of_file_type_t type; + OFFileAttributes attributes; + OFFileAttributeType type; if (source == nil || destination == nil) @throw [OFInvalidArgumentException exception]; pool = objc_autoreleasePoolPush(); @@ -599,22 +588,21 @@ errNo: e.errNo]; } type = attributes.fileType; - if ([type isEqual: of_file_type_directory]) { + if ([type isEqual: OFFileTypeDirectory]) { OFArray OF_GENERIC(OFURL *) *contents; @try { [self createDirectoryAtURL: destination]; @try { - of_file_attribute_key_t key = - of_file_attribute_key_posix_permissions; + OFFileAttributeKey key = OFFilePOSIXPermissions; OFNumber *permissions = [attributes objectForKey: key]; - of_file_attributes_t destinationAttributes; + OFFileAttributes destinationAttributes; if (permissions != nil) { destinationAttributes = [OFDictionary dictionaryWithObject: permissions forKey: key]; @@ -650,11 +638,11 @@ [self copyItemAtURL: item toURL: destinationURL]; objc_autoreleasePoolPop(pool2); } - } else if ([type isEqual: of_file_type_regular]) { + } else if ([type isEqual: OFFileTypeRegular]) { size_t pageSize = [OFSystemInfo pageSize]; OFStream *sourceStream = nil; OFStream *destinationStream = nil; char *buffer; @@ -676,15 +664,14 @@ [destinationStream writeBuffer: buffer length: length]; } @try { - of_file_attribute_key_t key = - of_file_attribute_key_posix_permissions; + OFFileAttributeKey key = OFFilePOSIXPermissions; OFNumber *permissions = [attributes objectForKey: key]; - of_file_attributes_t destinationAttributes; + OFFileAttributes destinationAttributes; if (permissions != nil) { destinationAttributes = [OFDictionary dictionaryWithObject: permissions forKey: key]; @@ -711,11 +698,11 @@ } @finally { [sourceStream close]; [destinationStream close]; free(buffer); } - } else if ([type isEqual: of_file_type_symbolic_link]) { + } else if ([type isEqual: OFFileTypeSymbolicLink]) { @try { OFString *linkDestination = attributes.fileSymbolicLinkDestination; [self createSymbolicLinkAtURL: destination @@ -912,72 +899,67 @@ @end @implementation OFDictionary (FileAttributes) - (unsigned long long)fileSize { - return [attributeForKeyOrException(self, of_file_attribute_key_size) + return [attributeForKeyOrException(self, OFFileSize) unsignedLongLongValue]; } -- (of_file_type_t)fileType +- (OFFileAttributeType)fileType { - return attributeForKeyOrException(self, of_file_attribute_key_type); + return attributeForKeyOrException(self, OFFileType); } - (unsigned long)filePOSIXPermissions { return [attributeForKeyOrException(self, - of_file_attribute_key_posix_permissions) unsignedLongValue]; -} - -- (unsigned long)filePOSIXUID -{ - return [attributeForKeyOrException(self, - of_file_attribute_key_posix_uid) unsignedLongValue]; -} - -- (unsigned long)filePOSIXGID -{ - return [attributeForKeyOrException(self, - of_file_attribute_key_posix_gid) unsignedLongValue]; -} - -- (OFString *)fileOwner -{ - return attributeForKeyOrException(self, of_file_attribute_key_owner); -} - -- (OFString *)fileGroup -{ - return attributeForKeyOrException(self, of_file_attribute_key_group); + OFFilePOSIXPermissions) unsignedLongValue]; +} + +- (unsigned long)fileOwnerAccountID +{ + return [attributeForKeyOrException(self, + OFFileOwnerAccountID) unsignedLongValue]; +} + +- (unsigned long)fileGroupOwnerAccountID +{ + return [attributeForKeyOrException(self, + OFFileGroupOwnerAccountID) unsignedLongValue]; +} + +- (OFString *)fileOwnerAccountName +{ + return attributeForKeyOrException(self, OFFileOwnerAccountName); +} + +- (OFString *)fileGroupOwnerAccountName +{ + return attributeForKeyOrException(self, OFFileGroupOwnerAccountName); } - (OFDate *)fileLastAccessDate { - return attributeForKeyOrException(self, - of_file_attribute_key_last_access_date); + return attributeForKeyOrException(self, OFFileLastAccessDate); } - (OFDate *)fileModificationDate { - return attributeForKeyOrException(self, - of_file_attribute_key_modification_date); + return attributeForKeyOrException(self, OFFileModificationDate); } - (OFDate *)fileStatusChangeDate { - return attributeForKeyOrException(self, - of_file_attribute_key_status_change_date); + return attributeForKeyOrException(self, OFFileStatusChangeDate); } - (OFDate *)fileCreationDate { - return attributeForKeyOrException(self, - of_file_attribute_key_creation_date); + return attributeForKeyOrException(self, OFFileCreationDate); } - (OFString *)fileSymbolicLinkDestination { - return attributeForKeyOrException(self, - of_file_attribute_key_symbolic_link_destination); + return attributeForKeyOrException(self, OFFileSymbolicLinkDestination); } @end Index: src/OFFileURLHandler.m ================================================================== --- src/OFFileURLHandler.m +++ src/OFFileURLHandler.m @@ -357,74 +357,69 @@ return of_stat(path, buffer); #endif } static void -setTypeAttribute(of_mutable_file_attributes_t attributes, of_stat_t *s) +setTypeAttribute(OFMutableFileAttributes attributes, of_stat_t *s) { if (S_ISREG(s->st_mode)) - [attributes setObject: of_file_type_regular - forKey: of_file_attribute_key_type]; + [attributes setObject: OFFileTypeRegular forKey: OFFileType]; else if (S_ISDIR(s->st_mode)) - [attributes setObject: of_file_type_directory - forKey: of_file_attribute_key_type]; + [attributes setObject: OFFileTypeDirectory forKey: OFFileType]; #ifdef S_ISLNK else if (S_ISLNK(s->st_mode)) - [attributes setObject: of_file_type_symbolic_link - forKey: of_file_attribute_key_type]; + [attributes setObject: OFFileTypeSymbolicLink + forKey: OFFileType]; #endif #ifdef S_ISFIFO else if (S_ISFIFO(s->st_mode)) - [attributes setObject: of_file_type_fifo - forKey: of_file_attribute_key_type]; + [attributes setObject: OFFileTypeFIFO forKey: OFFileType]; #endif #ifdef S_ISCHR else if (S_ISCHR(s->st_mode)) - [attributes setObject: of_file_type_character_special - forKey: of_file_attribute_key_type]; + [attributes setObject: OFFileTypeCharacterSpecial + forKey: OFFileType]; #endif #ifdef S_ISBLK else if (S_ISBLK(s->st_mode)) - [attributes setObject: of_file_type_block_special - forKey: of_file_attribute_key_type]; + [attributes setObject: OFFileTypeBlockSpecial + forKey: OFFileType]; #endif #ifdef S_ISSOCK else if (S_ISSOCK(s->st_mode)) - [attributes setObject: of_file_type_socket - forKey: of_file_attribute_key_type]; + [attributes setObject: OFFileTypeSocket forKey: OFFileType]; #endif } static void -setDateAttributes(of_mutable_file_attributes_t attributes, of_stat_t *s) +setDateAttributes(OFMutableFileAttributes attributes, of_stat_t *s) { /* FIXME: We could be more precise on some OSes */ [attributes setObject: [OFDate dateWithTimeIntervalSince1970: s->st_atime] - forKey: of_file_attribute_key_last_access_date]; + forKey: OFFileLastAccessDate]; [attributes setObject: [OFDate dateWithTimeIntervalSince1970: s->st_mtime] - forKey: of_file_attribute_key_modification_date]; + forKey: OFFileModificationDate]; [attributes setObject: [OFDate dateWithTimeIntervalSince1970: s->st_ctime] - forKey: of_file_attribute_key_status_change_date]; + forKey: OFFileStatusChangeDate]; #ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME [attributes setObject: [OFDate dateWithTimeIntervalSince1970: s->st_birthtime] - forKey: of_file_attribute_key_creation_date]; + forKey: OFFileCreationDate]; #endif } static void -setOwnerAndGroupAttributes(of_mutable_file_attributes_t attributes, - of_stat_t *s) +setOwnerAndGroupAttributes(OFMutableFileAttributes attributes, of_stat_t *s) { #ifdef OF_FILE_MANAGER_SUPPORTS_OWNER [attributes setObject: [NSNumber numberWithUnsignedLong: s->st_uid] - forKey: of_file_attribute_key_posix_uid]; + forKey: OFFileOwnerAccountID]; [attributes setObject: [NSNumber numberWithUnsignedLong: s->st_gid] - forKey: of_file_attribute_key_posix_gid]; + forKey: OFFileGroupOwnerAccountID]; # ifdef OF_HAVE_THREADS [passwdMutex lock]; @try { # endif @@ -436,20 +431,20 @@ OFString *owner = [OFString stringWithCString: passwd->pw_name encoding: encoding]; [attributes setObject: owner - forKey: of_file_attribute_key_owner]; + forKey: OFFileOwnerAccountName]; } if (group_ != NULL) { OFString *group = [OFString stringWithCString: group_->gr_name encoding: encoding]; [attributes setObject: group - forKey: of_file_attribute_key_group]; + forKey: OFFileGroupOwnerAccountName]; } # ifdef OF_HAVE_THREADS } @finally { [passwdMutex unlock]; } @@ -457,20 +452,19 @@ #endif } #ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS static void -setSymbolicLinkDestinationAttribute(of_mutable_file_attributes_t attributes, +setSymbolicLinkDestinationAttribute(OFMutableFileAttributes attributes, OFURL *URL) { OFString *path = URL.fileSystemRepresentation; # ifndef OF_WINDOWS OFStringEncoding encoding = [OFLocale encoding]; char destinationC[PATH_MAX]; ssize_t length; OFString *destination; - of_file_attribute_key_t key; length = readlink([path cStringWithEncoding: encoding], destinationC, PATH_MAX); if (length < 0) @@ -480,12 +474,12 @@ destination = [OFString stringWithCString: destinationC encoding: encoding length: length]; - key = of_file_attribute_key_symbolic_link_destination; - [attributes setObject: destination forKey: key]; + [attributes setObject: destination + forKey: OFFileSymbolicLinkDestination]; # else HANDLE handle; OFString *destination; if (func_CreateSymbolicLinkW == NULL) @@ -503,11 +497,10 @@ char bytes[MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; REPARSE_DATA_BUFFER data; } buffer; DWORD size; wchar_t *tmp; - of_file_attribute_key_t key; if (!DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, NULL, 0, buffer.bytes, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &size, NULL)) @throw [OFRetrieveItemAttributesFailedException @@ -526,14 +519,14 @@ destination = [OFString stringWithUTF16String: tmp length: slrb.SubstituteNameLength / sizeof(wchar_t)]; - [attributes setObject: of_file_type_symbolic_link - forKey: of_file_attribute_key_type]; - key = of_file_attribute_key_symbolic_link_destination; - [attributes setObject: destination forKey: key]; + [attributes setObject: OFFileTypeSymbolicLink + forKey: OFFileType]; + [attributes setObject: destination + forKey: OFFileSymbolicLinkDestination]; # undef slrb } @finally { CloseHandle(handle); } # endif @@ -602,13 +595,13 @@ objc_autoreleasePoolPop(pool); return [file autorelease]; } -- (of_file_attributes_t)attributesOfItemAtURL: (OFURL *)URL +- (OFFileAttributes)attributesOfItemAtURL: (OFURL *)URL { - of_mutable_file_attributes_t ret = [OFMutableDictionary dictionary]; + OFMutableFileAttributes ret = [OFMutableDictionary dictionary]; void *pool = objc_autoreleasePoolPush(); OFString *path; int error; of_stat_t s; @@ -627,16 +620,16 @@ if (s.st_size < 0) @throw [OFOutOfRangeException exception]; [ret setObject: [NSNumber numberWithUnsignedLongLong: s.st_size] - forKey: of_file_attribute_key_size]; + forKey: OFFileSize]; setTypeAttribute(ret, &s); [ret setObject: [NSNumber numberWithUnsignedLong: s.st_mode] - forKey: of_file_attribute_key_posix_permissions]; + forKey: OFFilePOSIXPermissions]; setOwnerAndGroupAttributes(ret, &s); setDateAttributes(ret, &s); #ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS @@ -650,16 +643,15 @@ } - (void)of_setLastAccessDate: (OFDate *)lastAccessDate andModificationDate: (OFDate *)modificationDate ofItemAtURL: (OFURL *)URL - attributes: (of_file_attributes_t)attributes OF_DIRECT + attributes: (OFFileAttributes)attributes OF_DIRECT { OFString *path = URL.fileSystemRepresentation; - of_file_attribute_key_t attributeKey = (modificationDate != nil - ? of_file_attribute_key_modification_date - : of_file_attribute_key_last_access_date); + OFFileAttributeKey attributeKey = (modificationDate != nil + ? OFFileModificationDate : OFFileLastAccessDate); if (lastAccessDate == nil) lastAccessDate = modificationDate; if (modificationDate == nil) modificationDate = lastAccessDate; @@ -764,11 +756,11 @@ #endif } - (void)of_setPOSIXPermissions: (OFNumber *)permissions ofItemAtURL: (OFURL *)URL - attributes: (of_file_attributes_t)attributes OF_DIRECT + attributes: (OFFileAttributes)attributes OF_DIRECT { #ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS mode_t mode = (mode_t)permissions.unsignedLongValue; OFString *path = URL.fileSystemRepresentation; int status; @@ -783,22 +775,22 @@ if (status != 0) @throw [OFSetItemAttributesFailedException exceptionWithURL: URL attributes: attributes - failedAttribute: of_file_attribute_key_posix_permissions + failedAttribute: OFFilePOSIXPermissions errNo: errno]; #else OF_UNRECOGNIZED_SELECTOR #endif } -- (void)of_setOwner: (OFString *)owner - andGroup: (OFString *)group - ofItemAtURL: (OFURL *)URL - attributeKey: (of_file_attribute_key_t)attributeKey - attributes: (of_file_attributes_t)attributes OF_DIRECT +- (void)of_setOwnerAccountName: (OFString *)owner + andGroupOwnerAccountName: (OFString *)group + ofItemAtURL: (OFURL *)URL + attributeKey: (OFFileAttributeKey)attributeKey + attributes: (OFFileAttributes)attributes OF_DIRECT { #ifdef OF_FILE_MANAGER_SUPPORTS_OWNER OFString *path = URL.fileSystemRepresentation; uid_t uid = -1; gid_t gid = -1; @@ -855,17 +847,16 @@ #else OF_UNRECOGNIZED_SELECTOR #endif } -- (void)setAttributes: (of_file_attributes_t)attributes - ofItemAtURL: (OFURL *)URL +- (void)setAttributes: (OFFileAttributes)attributes ofItemAtURL: (OFURL *)URL { void *pool = objc_autoreleasePoolPush(); - OFEnumerator OF_GENERIC(of_file_attribute_key_t) *keyEnumerator; + OFEnumerator OF_GENERIC(OFFileAttributeKey) *keyEnumerator; OFEnumerator *objectEnumerator; - of_file_attribute_key_t key; + OFFileAttributeKey key; id object; OFDate *lastAccessDate, *modificationDate; if (URL == nil) @throw [OFInvalidArgumentException exception]; @@ -876,39 +867,37 @@ keyEnumerator = [attributes keyEnumerator]; objectEnumerator = [attributes objectEnumerator]; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) { - if ([key isEqual: of_file_attribute_key_modification_date] || - [key isEqual: of_file_attribute_key_last_access_date]) + if ([key isEqual: OFFileModificationDate] || + [key isEqual: OFFileLastAccessDate]) continue; - else if ([key isEqual: of_file_attribute_key_posix_permissions]) + else if ([key isEqual: OFFilePOSIXPermissions]) [self of_setPOSIXPermissions: object ofItemAtURL: URL attributes: attributes]; - else if ([key isEqual: of_file_attribute_key_owner]) - [self of_setOwner: object - andGroup: nil - ofItemAtURL: URL - attributeKey: key - attributes: attributes]; - else if ([key isEqual: of_file_attribute_key_group]) - [self of_setOwner: nil - andGroup: object - ofItemAtURL: URL - attributeKey: key - attributes: attributes]; + else if ([key isEqual: OFFileOwnerAccountName]) + [self of_setOwnerAccountName: object + andGroupOwnerAccountName: nil + ofItemAtURL: URL + attributeKey: key + attributes: attributes]; + else if ([key isEqual: OFFileGroupOwnerAccountName]) + [self of_setOwnerAccountName: nil + andGroupOwnerAccountName: object + ofItemAtURL: URL + attributeKey: key + attributes: attributes]; else @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; } - lastAccessDate = [attributes - objectForKey: of_file_attribute_key_last_access_date]; - modificationDate = [attributes - objectForKey: of_file_attribute_key_modification_date]; + lastAccessDate = [attributes objectForKey: OFFileLastAccessDate]; + modificationDate = [attributes objectForKey: OFFileModificationDate]; if (lastAccessDate != nil || modificationDate != nil) [self of_setLastAccessDate: lastAccessDate andModificationDate: modificationDate ofItemAtURL: URL Index: src/OFURLHandler.h ================================================================== --- src/OFURLHandler.h +++ src/OFURLHandler.h @@ -96,24 +96,23 @@ /** * @brief Returns the attributes for the item at the specified URL. * * @param URL The URL to return the attributes for * @return A dictionary of attributes for the specified URL, with the keys of - * type @ref of_file_attribute_key_t + * type @ref OFFileAttributeKey */ -- (of_file_attributes_t)attributesOfItemAtURL: (OFURL *)URL; +- (OFFileAttributes)attributesOfItemAtURL: (OFURL *)URL; /** * @brief Sets the attributes for the item at the specified URL. * * All attributes not part of the dictionary are left unchanged. * * @param attributes The attributes to set for the specified URL * @param URL The URL of the item to set the attributes for */ -- (void)setAttributes: (of_file_attributes_t)attributes - ofItemAtURL: (OFURL *)URL; +- (void)setAttributes: (OFFileAttributes)attributes ofItemAtURL: (OFURL *)URL; /** * @brief Checks whether a file exists at the specified URL. * * @param URL The URL to check Index: src/OFURLHandler.m ================================================================== --- src/OFURLHandler.m +++ src/OFURLHandler.m @@ -138,17 +138,16 @@ - (OFStream *)openItemAtURL: (OFURL *)URL mode: (OFString *)mode { OF_UNRECOGNIZED_SELECTOR } -- (of_file_attributes_t)attributesOfItemAtURL: (OFURL *)URL +- (OFFileAttributes)attributesOfItemAtURL: (OFURL *)URL { OF_UNRECOGNIZED_SELECTOR } -- (void)setAttributes: (of_file_attributes_t)attributes - ofItemAtURL: (OFURL *)URL +- (void)setAttributes: (OFFileAttributes)attributes ofItemAtURL: (OFURL *)URL { OF_UNRECOGNIZED_SELECTOR } - (bool)fileExistsAtURL: (OFURL *)URL Index: src/exceptions/OFSetItemAttributesFailedException.h ================================================================== --- src/exceptions/OFSetItemAttributesFailedException.h +++ src/exceptions/OFSetItemAttributesFailedException.h @@ -28,12 +28,12 @@ * @brief An exception indicating an item's attributes could not be set. */ @interface OFSetItemAttributesFailedException: OFException { OFURL *_URL; - of_file_attributes_t _attributes; - of_file_attribute_key_t _failedAttribute; + OFFileAttributes _attributes; + OFFileAttributeKey _failedAttribute; int _errNo; } /** * @brief The URL of the item whose attributes could not be set. @@ -46,16 +46,16 @@ @property (readonly, nonatomic) int errNo; /** * @brief The attributes that should have been set. */ -@property (readonly, nonatomic) of_file_attributes_t attributes; +@property (readonly, nonatomic) OFFileAttributes attributes; /** * @brief The first attribute that could not be set. */ -@property (readonly, nonatomic) of_file_attribute_key_t failedAttribute; +@property (readonly, nonatomic) OFFileAttributeKey failedAttribute; + (instancetype)exception OF_UNAVAILABLE; /** * @brief Creates a new, autoreleased set item attributes failed exception. @@ -66,12 +66,12 @@ * @param failedAttribute The first attribute that could not be set * @param errNo The errno of the error that occurred * @return A new, autoreleased set item attributes failed exception */ + (instancetype)exceptionWithURL: (OFURL *)URL - attributes: (of_file_attributes_t)attributes - failedAttribute: (of_file_attribute_key_t)failedAttribute + attributes: (OFFileAttributes)attributes + failedAttribute: (OFFileAttributeKey)failedAttribute errNo: (int)errNo; - (instancetype)init OF_UNAVAILABLE; /** @@ -83,11 +83,11 @@ * @param failedAttribute The first attribute that could not be set * @param errNo The errno of the error that occurred * @return An initialized set item attributes failed exception */ - (instancetype)initWithURL: (OFURL *)URL - attributes: (of_file_attributes_t)attributes - failedAttribute: (of_file_attribute_key_t)failedAttribute + attributes: (OFFileAttributes)attributes + failedAttribute: (OFFileAttributeKey)failedAttribute errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFSetItemAttributesFailedException.m ================================================================== --- src/exceptions/OFSetItemAttributesFailedException.m +++ src/exceptions/OFSetItemAttributesFailedException.m @@ -27,12 +27,12 @@ { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithURL: (OFURL *)URL - attributes: (of_file_attributes_t)attributes - failedAttribute: (of_file_attribute_key_t)failedAttribute + attributes: (OFFileAttributes)attributes + failedAttribute: (OFFileAttributeKey)failedAttribute errNo: (int)errNo { return [[[self alloc] initWithURL: URL attributes: attributes failedAttribute: failedAttribute @@ -43,12 +43,12 @@ { OF_INVALID_INIT_METHOD } - (instancetype)initWithURL: (OFURL *)URL - attributes: (of_file_attributes_t)attributes - failedAttribute: (of_file_attribute_key_t)failedAttribute + attributes: (OFFileAttributes)attributes + failedAttribute: (OFFileAttributeKey)failedAttribute errNo: (int)errNo { self = [super init]; @try { Index: utils/ofarc/GZIPArchive.m ================================================================== --- utils/ofarc/GZIPArchive.m +++ utils/ofarc/GZIPArchive.m @@ -28,14 +28,14 @@ static void setPermissions(OFString *destination, OFString *source) { #ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS OFFileManager *fileManager = [OFFileManager defaultManager]; - of_file_attributes_t attributes = - [fileManager attributesOfItemAtPath: source]; - of_file_attribute_key_t key = of_file_attribute_key_posix_permissions; - of_file_attributes_t destinationAttributes = [OFDictionary + OFFileAttributes attributes = [fileManager + attributesOfItemAtPath: source]; + OFFileAttributeKey key = OFFilePOSIXPermissions; + OFFileAttributes destinationAttributes = [OFDictionary dictionaryWithObject: [attributes objectForKey: key] forKey: key]; [fileManager setAttributes: destinationAttributes ofItemAtPath: destination]; @@ -44,18 +44,18 @@ static void setModificationDate(OFString *path, OFGZIPStream *stream) { OFDate *modificationDate = stream.modificationDate; - of_file_attributes_t attributes; + OFFileAttributes attributes; if (modificationDate == nil) return; attributes = [OFDictionary dictionaryWithObject: modificationDate - forKey: of_file_attribute_key_modification_date]; + forKey: OFFileModificationDate]; [[OFFileManager defaultManager] setAttributes: attributes ofItemAtPath: path]; } @implementation GZIPArchive Index: utils/ofarc/LHAArchive.m ================================================================== --- utils/ofarc/LHAArchive.m +++ utils/ofarc/LHAArchive.m @@ -46,13 +46,13 @@ return; mode = [OFNumber numberWithUnsignedShort: mode.unsignedShortValue & 0777]; - of_file_attributes_t attributes = [OFDictionary + OFFileAttributes attributes = [OFDictionary dictionaryWithObject: mode - forKey: of_file_attribute_key_posix_permissions]; + forKey: OFFilePOSIXPermissions]; [[OFFileManager defaultManager] setAttributes: attributes ofItemAtPath: path]; #endif } @@ -59,11 +59,11 @@ static void setModificationDate(OFString *path, OFLHAArchiveEntry *entry) { OFDate *modificationDate = entry.modificationDate; - of_file_attributes_t attributes; + OFFileAttributes attributes; if (modificationDate == nil) { /* * Fall back to the original date if we have no modification * date, as the modification date is a UNIX extension. @@ -74,11 +74,11 @@ return; } attributes = [OFDictionary dictionaryWithObject: modificationDate - forKey: of_file_attribute_key_modification_date]; + forKey: OFFileModificationDate]; [[OFFileManager defaultManager] setAttributes: attributes ofItemAtPath: path]; } @implementation LHAArchive @@ -451,12 +451,12 @@ return; } for (OFString *fileName in files) { void *pool = objc_autoreleasePoolPush(); - of_file_attributes_t attributes; - of_file_type_t type; + OFFileAttributes attributes; + OFFileAttributeType type; OFMutableLHAArchiveEntry *entry; OFStream *output; if (app->_outputLevel >= 0) [of_stdout writeString: OF_LOCALIZED(@"adding_file", @@ -472,24 +472,24 @@ attributes.filePOSIXPermissions]; #endif entry.date = attributes.fileModificationDate; #ifdef OF_FILE_MANAGER_SUPPORTS_OWNER - entry.UID = - [OFNumber numberWithUnsignedLong: attributes.filePOSIXUID]; - entry.GID = - [OFNumber numberWithUnsignedLong: attributes.filePOSIXGID]; - entry.owner = attributes.fileOwner; - entry.group = attributes.fileGroup; + entry.UID = [OFNumber numberWithUnsignedLong: + attributes.fileOwnerAccountID]; + entry.GID = [OFNumber numberWithUnsignedLong: + attributes.fileGroupOwnerAccountID]; + entry.owner = attributes.fileOwnerAccountName; + entry.group = attributes.fileGroupOwnerAccountName; #endif - if ([type isEqual: of_file_type_directory]) + if ([type isEqual: OFFileTypeDirectory]) entry.compressionMethod = @"-lhd-"; output = [_archive streamForWritingEntry: entry]; - if ([type isEqual: of_file_type_regular]) { + if ([type isEqual: OFFileTypeRegular]) { unsigned long long written = 0; unsigned long long size = attributes.fileSize; int8_t percent = -1, newPercent; OFFile *input = [OFFile fileWithPath: fileName Index: utils/ofarc/TarArchive.m ================================================================== --- utils/ofarc/TarArchive.m +++ utils/ofarc/TarArchive.m @@ -32,13 +32,13 @@ static void setPermissions(OFString *path, OFTarArchiveEntry *entry) { #ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS OFNumber *mode = [OFNumber numberWithUnsignedShort: entry.mode & 0777]; - of_file_attributes_t attributes = [OFDictionary + OFFileAttributes attributes = [OFDictionary dictionaryWithObject: mode - forKey: of_file_attribute_key_posix_permissions]; + forKey: OFFilePOSIXPermissions]; [[OFFileManager defaultManager] setAttributes: attributes ofItemAtPath: path]; #endif } @@ -45,18 +45,18 @@ static void setModificationDate(OFString *path, OFTarArchiveEntry *entry) { OFDate *modificationDate = entry.modificationDate; - of_file_attributes_t attributes; + OFFileAttributes attributes; if (modificationDate == nil) return; attributes = [OFDictionary dictionaryWithObject: modificationDate - forKey: of_file_attribute_key_modification_date]; + forKey: OFFileModificationDate]; [[OFFileManager defaultManager] setAttributes: attributes ofItemAtPath: path]; } @implementation TarArchive @@ -462,12 +462,12 @@ return; } for (OFString *fileName in files) { void *pool = objc_autoreleasePoolPush(); - of_file_attributes_t attributes; - of_file_type_t type; + OFFileAttributes attributes; + OFFileAttributeType type; OFMutableTarArchiveEntry *entry; OFStream *output; if (app->_outputLevel >= 0) [of_stdout writeString: OF_LOCALIZED(@"adding_file", @@ -483,22 +483,22 @@ #endif entry.size = attributes.fileSize; entry.modificationDate = attributes.fileModificationDate; #ifdef OF_FILE_MANAGER_SUPPORTS_OWNER - entry.UID = attributes.filePOSIXUID; - entry.GID = attributes.filePOSIXGID; - entry.owner = attributes.fileOwner; - entry.group = attributes.fileGroup; + entry.UID = attributes.fileOwnerAccountID; + entry.GID = attributes.fileGroupOwnerAccountID; + entry.owner = attributes.fileOwnerAccountName; + entry.group = attributes.fileGroupOwnerAccountName; #endif - if ([type isEqual: of_file_type_regular]) + if ([type isEqual: OFFileTypeRegular]) entry.type = OF_TAR_ARCHIVE_ENTRY_TYPE_FILE; - else if ([type isEqual: of_file_type_directory]) { + else if ([type isEqual: OFFileTypeDirectory]) { entry.type = OF_TAR_ARCHIVE_ENTRY_TYPE_DIRECTORY; entry.size = 0; - } else if ([type isEqual: of_file_type_symbolic_link]) { + } else if ([type isEqual: OFFileTypeSymbolicLink]) { entry.type = OF_TAR_ARCHIVE_ENTRY_TYPE_SYMLINK; entry.targetFileName = attributes.fileSymbolicLinkDestination; entry.size = 0; } Index: utils/ofarc/ZIPArchive.m ================================================================== --- utils/ofarc/ZIPArchive.m +++ utils/ofarc/ZIPArchive.m @@ -42,14 +42,13 @@ #ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS if ((entry.versionMadeBy >> 8) == OF_ZIP_ARCHIVE_ENTRY_ATTR_COMPAT_UNIX) { OFNumber *mode = [OFNumber numberWithUnsignedShort: (entry.versionSpecificAttributes >> 16) & 0777]; - of_file_attribute_key_t key = - of_file_attribute_key_posix_permissions; - of_file_attributes_t attributes = - [OFDictionary dictionaryWithObject: mode forKey: key]; + OFFileAttributes attributes = [OFDictionary + dictionaryWithObject: mode + forKey: OFFilePOSIXPermissions]; [[OFFileManager defaultManager] setAttributes: attributes ofItemAtPath: path]; } #endif @@ -57,18 +56,18 @@ static void setModificationDate(OFString *path, OFZIPArchiveEntry *entry) { OFDate *modificationDate = entry.modificationDate; - of_file_attributes_t attributes; + OFFileAttributes attributes; if (modificationDate == nil) return; attributes = [OFDictionary dictionaryWithObject: modificationDate - forKey: of_file_attribute_key_modification_date]; + forKey: OFFileModificationDate]; [[OFFileManager defaultManager] setAttributes: attributes ofItemAtPath: path]; } @implementation ZIPArchive @@ -412,11 +411,11 @@ for (OFString *localFileName in files) { void *pool = objc_autoreleasePoolPush(); OFArray OF_GENERIC (OFString *) *components; OFString *fileName; - of_file_attributes_t attributes; + OFFileAttributes attributes; bool isDirectory = false; OFMutableZIPArchiveEntry *entry; unsigned long long size; OFStream *output; @@ -424,11 +423,11 @@ fileName = [components componentsJoinedByString: @"/"]; attributes = [fileManager attributesOfItemAtPath: localFileName]; - if ([attributes.fileType isEqual: of_file_type_directory]) { + if ([attributes.fileType isEqual: OFFileTypeDirectory]) { isDirectory = true; fileName = [fileName stringByAppendingString: @"/"]; } if (app->_outputLevel >= 0)