Overview
Comment: | Make OFFileManager available with --disable-files
As OFFileManager also works with remote URLs, it makes sense to also |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c52f38388ccfa7984d08565b8a8ba120 |
User & Date: | js on 2019-04-11 00:34:43 |
Other Links: | manifest | tags |
Context
2019-04-14
| ||
10:59 | OFStringTests: Fix a new Clang warning check-in: efb964a3ae user: js tags: trunk | |
2019-04-11
| ||
00:34 | Make OFFileManager available with --disable-files check-in: c52f38388c user: js tags: trunk | |
2019-04-10
| ||
21:22 | Use GetFileAttributesW() to see if a file exists check-in: e6e027971e user: js tags: trunk | |
Changes
Modified src/Makefile from [2eb6f3cb8d] to [f656662078].
︙ | ︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | OFData.m \ OFData+ASN1DERValue.m \ OFData+CryptoHashing.m \ OFData+MessagePackValue.m \ OFDate.m \ OFDictionary.m \ OFEnumerator.m \ OFGZIPStream.m \ OFHMAC.m \ OFInflate64Stream.m \ OFInflateStream.m \ OFIntrospection.m \ OFInvocation.m \ OFLHAArchive.m \ | > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | OFData.m \ OFData+ASN1DERValue.m \ OFData+CryptoHashing.m \ OFData+MessagePackValue.m \ OFDate.m \ OFDictionary.m \ OFEnumerator.m \ OFFileManager.m \ OFGZIPStream.m \ OFHMAC.m \ OFInflate64Stream.m \ OFInflateStream.m \ OFIntrospection.m \ OFInvocation.m \ OFLHAArchive.m \ |
︙ | ︙ | |||
125 126 127 128 129 130 131 | ${UNICODE_M} \ ${USE_SRCS_FILES} \ ${USE_SRCS_PLUGINS} \ ${USE_SRCS_SOCKETS} \ ${USE_SRCS_THREADS} \ ${USE_SRCS_WINDOWS} SRCS_FILES = OFFile.m \ | < | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | ${UNICODE_M} \ ${USE_SRCS_FILES} \ ${USE_SRCS_PLUGINS} \ ${USE_SRCS_SOCKETS} \ ${USE_SRCS_THREADS} \ ${USE_SRCS_WINDOWS} SRCS_FILES = OFFile.m \ OFINICategory.m \ OFINIFile.m \ OFSettings.m \ OFString+PathAdditions.m SRCS_PLUGINS = OFPlugin.m SRCS_SOCKETS = OFDNSResolver.m \ OFDNSResourceRecord.m \ |
︙ | ︙ |
Modified src/OFFileManager.h from [50ca602524] to [cab2ec45e5].
︙ | ︙ | |||
12 13 14 15 16 17 18 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" | | > > > | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" #import "OFDictionary.h" OF_ASSUME_NONNULL_BEGIN /*! @file */ #ifdef OF_HAVE_FILES # if defined(OF_HAVE_CHMOD) && !defined(OF_AMIGAOS) # define OF_FILE_MANAGER_SUPPORTS_PERMISSIONS # endif # if defined(OF_HAVE_CHOWN) && !defined(OF_AMIGAOS) # define OF_FILE_MANAGER_SUPPORTS_OWNER # endif # if (defined(OF_HAVE_LINK) && !defined(OF_AMIGAOS)) || defined(OF_WINDOWS) # define OF_FILE_MANAGER_SUPPORTS_LINKS # endif # if (defined(OF_HAVE_SYMLINK) && !defined(OF_AMIGAOS)) || defined(OF_WINDOWS) # define OF_FILE_MANAGER_SUPPORTS_SYMLINKS # endif #endif @class OFArray OF_GENERIC(ObjectType); @class OFConstantString; @class OFDate; @class OFString; @class OFURL; /*! * @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_symbolic_link_destination * * Other URL schemes might not have all keys and might have keys not listed. */ typedef OFConstantString *of_file_attribute_key_t; /*! * @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 * * 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; #ifdef __cplusplus extern "C" { #endif /*! * @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; /*! * @brief The type of the file. * * The corresponding value is of type @ref of_file_type_t. * * 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; /*! * @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 @ref 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 @ref 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; /*! * @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; /*! * @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; /*! * @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; /*! * @brief The destination of a symbolic link as an @ref 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; /*! * @brief A regular file. */ extern const of_file_type_t of_file_type_regular; /*! * @brief A directory. */ extern const of_file_type_t of_file_type_directory; /*! * @brief A symbolic link. */ extern const of_file_type_t of_file_type_symbolic_link; /*! * @brief A FIFO. */ extern const of_file_type_t of_file_type_fifo; /*! * @brief A character special file. */ extern const of_file_type_t of_file_type_character_special; /*! * @brief A block special file. */ extern const of_file_type_t of_file_type_block_special; /*! * @brief A socket. */ extern const of_file_type_t of_file_type_socket; #ifdef __cplusplus } #endif /*! * @class OFFileManager OFFileManager.h ObjFW/OFFileManager.h * * @brief A class which provides management for files, e.g. reading contents of * directories, deleting files, renaming files, etc. */ @interface OFFileManager: OFObject #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nonatomic) OFFileManager *defaultManager; #endif #ifdef OF_HAVE_FILES /*! * @brief The path of the current working directory. */ @property (readonly, nonatomic) OFString *currentDirectoryPath; /*! * @brief The URL of the current working directory. */ @property (readonly, nonatomic) OFURL *currentDirectoryURL; #endif /*! * @brief Returns the default file manager. */ + (OFFileManager *)defaultManager; #ifdef OF_HAVE_FILES /*! * @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 */ - (of_file_attributes_t)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 */ - (of_file_attributes_t)attributesOfItemAtURL: (OFURL *)URL; #ifdef OF_HAVE_FILES /*! * @brief Sets the attributes for the item at the specified path. * * 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 ofItemAtPath: (OFString *)path; #endif /*! * @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; #ifdef OF_HAVE_FILES /*! * @brief Checks whether a file exists at the specified path. * * @param path The path to check * @return A boolean whether there is a file at the specified path */ - (bool)fileExistsAtPath: (OFString *)path; #endif /*! * @brief Checks whether a file exists at the specified URL. * * @param URL The URL to check * @return A boolean whether there is a file at the specified URL */ - (bool)fileExistsAtURL: (OFURL *)URL; #ifdef OF_HAVE_FILES /*! * @brief Checks whether a directory exists at the specified path. * * @param path The path to check * @return A boolean whether there is a directory at the specified path */ - (bool)directoryExistsAtPath: (OFString *)path; #endif /*! * @brief Checks whether a directory exists at the specified URL. * * @param URL The URL to check * @return A boolean whether there is a directory at the specified URL */ - (bool)directoryExistsAtURL: (OFURL *)URL; #ifdef OF_HAVE_FILES /*! * @brief Creates a directory at the specified path. * * @param path The path of the directory to create */ - (void)createDirectoryAtPath: (OFString *)path; /*! * @brief Creates a directory at the specified path. * * @param path The path of the directory to create * @param createParents Whether to create the parents of the directory */ - (void)createDirectoryAtPath: (OFString *)path createParents: (bool)createParents; #endif /*! * @brief Creates a directory at the specified URL. * * @param URL The URL of the directory to create */ - (void)createDirectoryAtURL: (OFURL *)URL; /*! * @brief Creates a directory at the specified URL. * * @param URL The URL of the directory to create * @param createParents Whether to create the parents of the directory */ - (void)createDirectoryAtURL: (OFURL *)URL createParents: (bool)createParents; #ifdef OF_HAVE_FILES /*! * @brief Returns an array with the items in the specified directory. * * @note `.` and `..` are not part of the returned array. * * @param path The path to the directory whose items should be returned * @return An array of OFString with the items in the specified directory */ - (OFArray OF_GENERIC(OFString *) *)contentsOfDirectoryAtPath: (OFString *)path; #endif /*! * @brief Returns an array with the items in the specified directory. * * @note `.` and `..` are not part of the returned array. * * @param URL The URL to the directory whose items should be returned * @return An array of OFString with the items in the specified directory */ - (OFArray OF_GENERIC(OFString *) *)contentsOfDirectoryAtURL: (OFURL *)URL; #ifdef OF_HAVE_FILES /*! * @brief Changes the current working directory. * * @param path The new directory to change to */ - (void)changeCurrentDirectoryPath: (OFString *)path; |
︙ | ︙ | |||
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | * directory. * * @param source The file, directory or symbolic link to copy * @param destination The destination path */ - (void)copyItemAtPath: (OFString *)source toPath: (OFString *)destination; /*! * @brief Copies a file, directory or symbolic link (if supported by the OS). * * The destination URL must have a full path, which means it must include the * name of the item. * * If an item already exists, the copy operation fails. This is also the case * if a directory is copied and an item already exists in the destination * directory. * * @param source The file, directory or symbolic link to copy * @param destination The destination URL */ - (void)copyItemAtURL: (OFURL *)source toURL: (OFURL *)destination; /*! * @brief Moves an item. * * The destination path must be a full path, which means it must include the * name of the item. * * If the destination is on a different logical device, the source will be * copied to the destination using @ref copyItemAtPath:toPath: and the source * removed using @ref removeItemAtPath:. * * @param source The item to rename * @param destination The new name for the item */ - (void)moveItemAtPath: (OFString *)source toPath: (OFString *)destination; /*! * @brief Moves an item. * * The destination URL must have a full path, which means it must include the * name of the item. * * If the destination is on a different logical device or uses a different * scheme, the source will be copied to the destination using * @ref copyItemAtURL:toURL: and the source removed using @ref removeItemAtURL:. * * @param source The item to rename * @param destination The new name for the item */ - (void)moveItemAtURL: (OFURL *)source toURL: (OFURL *)destination; /*! * @brief Removes the item at the specified path. * * If the item at the specified path is a directory, it is removed recursively. * * @param path The path to the item which should be removed */ - (void)removeItemAtPath: (OFString *)path; /*! * @brief Removes the item at the specified URL. * * If the item at the specified URL is a directory, it is removed recursively. * * @param URL The URL to the item which should be removed | > > > > > | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | * directory. * * @param source The file, directory or symbolic link to copy * @param destination The destination path */ - (void)copyItemAtPath: (OFString *)source toPath: (OFString *)destination; #endif /*! * @brief Copies a file, directory or symbolic link (if supported by the OS). * * The destination URL must have a full path, which means it must include the * name of the item. * * If an item already exists, the copy operation fails. This is also the case * if a directory is copied and an item already exists in the destination * directory. * * @param source The file, directory or symbolic link to copy * @param destination The destination URL */ - (void)copyItemAtURL: (OFURL *)source toURL: (OFURL *)destination; #ifdef OF_HAVE_FILES /*! * @brief Moves an item. * * The destination path must be a full path, which means it must include the * name of the item. * * If the destination is on a different logical device, the source will be * copied to the destination using @ref copyItemAtPath:toPath: and the source * removed using @ref removeItemAtPath:. * * @param source The item to rename * @param destination The new name for the item */ - (void)moveItemAtPath: (OFString *)source toPath: (OFString *)destination; #endif /*! * @brief Moves an item. * * The destination URL must have a full path, which means it must include the * name of the item. * * If the destination is on a different logical device or uses a different * scheme, the source will be copied to the destination using * @ref copyItemAtURL:toURL: and the source removed using @ref removeItemAtURL:. * * @param source The item to rename * @param destination The new name for the item */ - (void)moveItemAtURL: (OFURL *)source toURL: (OFURL *)destination; #ifdef OF_HAVE_FILES /*! * @brief Removes the item at the specified path. * * If the item at the specified path is a directory, it is removed recursively. * * @param path The path to the item which should be removed */ - (void)removeItemAtPath: (OFString *)path; #endif /*! * @brief Removes the item at the specified URL. * * If the item at the specified URL is a directory, it is removed recursively. * * @param URL The URL to the item which should be removed |
︙ | ︙ | |||
345 346 347 348 349 350 351 352 353 | * * @param URL The URL to the item which should symbolically link to the target * @param target The target of the symbolic link */ - (void)createSymbolicLinkAtURL: (OFURL *)URL withDestinationPath: (OFString *)target; @end OF_ASSUME_NONNULL_END | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | * * @param URL The URL to the item which should symbolically link to the target * @param target The target of the symbolic link */ - (void)createSymbolicLinkAtURL: (OFURL *)URL withDestinationPath: (OFString *)target; @end @interface OFDictionary (FileAttributes) /*! * The @ref of_file_attribute_key_size key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) uintmax_t fileSize; /*! * The @ref of_file_attribute_key_type key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) of_file_type_t fileType; /*! * The @ref of_file_attribute_key_posix_permissions key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) uint16_t filePOSIXPermissions; /*! * The @ref of_file_attribute_key_posix_uid key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) uint32_t filePOSIXUID; /*! * The @ref of_file_attribute_key_posix_gid key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) uint32_t filePOSIXGID; /*! * 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; /*! * 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; /*! * The @ref of_file_attribute_key_last_access_date key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) OFDate *fileLastAccessDate; /*! * The @ref of_file_attribute_key_modification_date key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) OFDate *fileModificationDate; /*! * The @ref of_file_attribute_key_status_change_date key from the dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) OFDate *fileStatusChangeDate; /*! * The @ref of_file_attribute_key_symbolic_link_destination key from the * dictionary. * * Raises an @ref OFUndefinedKeyException if the key is missing. */ @property (readonly, nonatomic) OFString *fileSymbolicLinkDestination; @end OF_ASSUME_NONNULL_END |
Modified src/OFFileManager.m from [5e553d195f] to [8f91c19e94].
︙ | ︙ | |||
26 27 28 29 30 31 32 | #ifdef OF_PSP # include <sys/syslimits.h> #endif #import "OFArray.h" #import "OFDate.h" #import "OFDictionary.h" | > | > > > > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #ifdef OF_PSP # include <sys/syslimits.h> #endif #import "OFArray.h" #import "OFDate.h" #import "OFDictionary.h" #ifdef OF_HAVE_FILES # import "OFFile.h" #endif #import "OFFileManager.h" #import "OFLocale.h" #import "OFNumber.h" #import "OFStream.h" #import "OFString.h" #import "OFSystemInfo.h" #import "OFURL.h" #import "OFURLHandler.h" #import "OFChangeCurrentDirectoryPathFailedException.h" #import "OFCopyItemFailedException.h" #import "OFCreateDirectoryFailedException.h" #import "OFGetCurrentDirectoryPathFailedException.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFMoveItemFailedException.h" #import "OFNotImplementedException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "OFRemoveItemFailedException.h" #import "OFRetrieveItemAttributesFailedException.h" #import "OFUndefinedKeyException.h" #import "OFUnsupportedProtocolException.h" #ifdef OF_WINDOWS # include <windows.h> # include <direct.h> # include <ntdef.h> #endif |
︙ | ︙ | |||
68 69 70 71 72 73 74 75 76 77 78 79 80 81 | # include <proto/dos.h> # include <proto/locale.h> #endif @interface OFFileManager_default: OFFileManager @end #ifdef OF_AMIGAOS4 extern struct ExecIFace *IExec; static struct Library *DOSBase = NULL; static struct DOSIFace *IDOS = NULL; #endif static OFFileManager *defaultManager; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | # include <proto/dos.h> # include <proto/locale.h> #endif @interface OFFileManager_default: 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_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"; #ifdef OF_AMIGAOS4 extern struct ExecIFace *IExec; static struct Library *DOSBase = NULL; static struct DOSIFace *IDOS = NULL; #endif static OFFileManager *defaultManager; |
︙ | ︙ | |||
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | DropInterface(IDOS); if (DOSBase != NULL) CloseLibrary(DOSBase); # endif } #endif @implementation OFFileManager + (void)initialize { if (self != [OFFileManager class]) return; #ifdef OF_AMIGAOS4 if ((DOSBase = OpenLibrary("dos.library", 36)) == NULL) @throw [OFInitializationFailedException exceptionWithClass: self]; if ((IDOS = (struct DOSIFace *) GetInterface(DOSBase, "main", 1, NULL)) == NULL) @throw [OFInitializationFailedException exceptionWithClass: self]; #endif /* * Make sure OFFile is initialized. * On some systems, this is needed to initialize the file system driver. */ [OFFile class]; defaultManager = [[OFFileManager_default alloc] init]; } + (OFFileManager *)defaultManager { return defaultManager; } - (OFString *)currentDirectoryPath { | > > > > > > > > > > > > > > > > | | | | | | > > > > > > > > > | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | DropInterface(IDOS); if (DOSBase != NULL) CloseLibrary(DOSBase); # endif } #endif static id attributeForKeyOrException(of_file_attributes_t attributes, of_file_attribute_key_t key) { id object = [attributes objectForKey: key]; if (object == nil) @throw [OFUndefinedKeyException exceptionWithObject: attributes key: key]; return object; } @implementation OFFileManager + (void)initialize { if (self != [OFFileManager class]) return; #ifdef OF_AMIGAOS4 if ((DOSBase = OpenLibrary("dos.library", 36)) == NULL) @throw [OFInitializationFailedException exceptionWithClass: self]; if ((IDOS = (struct DOSIFace *) GetInterface(DOSBase, "main", 1, NULL)) == NULL) @throw [OFInitializationFailedException exceptionWithClass: self]; #endif #ifdef OF_HAVE_FILES /* * Make sure OFFile is initialized. * On some systems, this is needed to initialize the file system driver. */ [OFFile class]; #endif defaultManager = [[OFFileManager_default alloc] init]; } + (OFFileManager *)defaultManager { return defaultManager; } #ifdef OF_HAVE_FILES - (OFString *)currentDirectoryPath { # if defined(OF_WINDOWS) OFString *ret; wchar_t *buffer = _wgetcwd(NULL, 0); @try { ret = [OFString stringWithUTF16String: buffer]; } @finally { free(buffer); } return ret; # elif defined(OF_AMIGAOS) char buffer[512]; if (!NameFromLock(((struct Process *)FindTask(NULL))->pr_CurrentDir, buffer, 512)) { if (IoErr() == ERROR_LINE_TOO_LONG) @throw [OFOutOfRangeException exception]; return nil; } return [OFString stringWithCString: buffer encoding: [OFLocale encoding]]; # else char buffer[PATH_MAX]; if ((getcwd(buffer, PATH_MAX)) == NULL) @throw [OFGetCurrentDirectoryPathFailedException exceptionWithErrNo: errno]; # ifdef OF_DJGPP /* * For some reason, getcwd() returns forward slashes on DJGPP, even * though the native format is to use backwards slashes. */ for (char *tmp = buffer; *tmp != '\0'; tmp++) if (*tmp == '/') *tmp = '\\'; # endif return [OFString stringWithCString: buffer encoding: [OFLocale encoding]]; # endif } - (OFURL *)currentDirectoryURL { void *pool = objc_autoreleasePoolPush(); OFURL *ret; ret = [OFURL fileURLWithPath: self.currentDirectoryPath]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } #endif - (of_file_attributes_t)attributesOfItemAtURL: (OFURL *)URL { OFURLHandler *URLHandler; if (URL == nil) @throw [OFInvalidArgumentException exception]; if ((URLHandler = [OFURLHandler handlerForURL: URL]) == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; return [URLHandler attributesOfItemAtURL: URL]; } #ifdef OF_HAVE_FILES - (of_file_attributes_t)attributesOfItemAtPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); of_file_attributes_t ret; ret = [self attributesOfItemAtURL: [OFURL fileURLWithPath: path]]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } #endif - (void)setAttributes: (of_file_attributes_t)attributes ofItemAtURL: (OFURL *)URL { OFURLHandler *URLHandler; if (URL == nil) @throw [OFInvalidArgumentException exception]; if ((URLHandler = [OFURLHandler handlerForURL: URL]) == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; [URLHandler setAttributes: attributes ofItemAtURL: URL]; } #ifdef OF_HAVE_FILES - (void)setAttributes: (of_file_attributes_t)attributes ofItemAtPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); [self setAttributes: attributes ofItemAtURL: [OFURL fileURLWithPath: path]]; objc_autoreleasePoolPop(pool); } #endif - (bool)fileExistsAtURL: (OFURL *)URL { OFURLHandler *URLHandler; if (URL == nil) @throw [OFInvalidArgumentException exception]; if ((URLHandler = [OFURLHandler handlerForURL: URL]) == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; return [URLHandler fileExistsAtURL: URL]; } #ifdef OF_HAVE_FILES - (bool)fileExistsAtPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); bool ret; ret = [self fileExistsAtURL: [OFURL fileURLWithPath: path]]; objc_autoreleasePoolPop(pool); return ret; } #endif - (bool)directoryExistsAtURL: (OFURL *)URL { OFURLHandler *URLHandler; if (URL == nil) @throw [OFInvalidArgumentException exception]; if ((URLHandler = [OFURLHandler handlerForURL: URL]) == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; return [URLHandler directoryExistsAtURL: URL]; } #ifdef OF_HAVE_FILES - (bool)directoryExistsAtPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); bool ret; ret = [self directoryExistsAtURL: [OFURL fileURLWithPath: path]]; objc_autoreleasePoolPop(pool); return ret; } #endif - (void)createDirectoryAtURL: (OFURL *)URL { OFURLHandler *URLHandler; if (URL == nil) @throw [OFInvalidArgumentException exception]; |
︙ | ︙ | |||
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | ![self directoryExistsAtURL: URL]) [self createDirectoryAtURL: URL]; } objc_autoreleasePoolPop(pool); } - (void)createDirectoryAtPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); [self createDirectoryAtURL: [OFURL fileURLWithPath: path]]; objc_autoreleasePoolPop(pool); } - (void)createDirectoryAtPath: (OFString *)path createParents: (bool)createParents { void *pool = objc_autoreleasePoolPush(); [self createDirectoryAtURL: [OFURL fileURLWithPath: path] createParents: createParents]; objc_autoreleasePoolPop(pool); } - (OFArray OF_GENERIC(OFString *) *)contentsOfDirectoryAtURL: (OFURL *)URL { OFURLHandler *URLHandler; if (URL == nil) @throw [OFInvalidArgumentException exception]; if ((URLHandler = [OFURLHandler handlerForURL: URL]) == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; return [URLHandler contentsOfDirectoryAtURL: URL]; } - (OFArray OF_GENERIC(OFString *) *)contentsOfDirectoryAtPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); OFArray OF_GENERIC(OFString *) *ret; ret = [self contentsOfDirectoryAtURL: [OFURL fileURLWithPath: path]]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } - (void)changeCurrentDirectoryPath: (OFString *)path { if (path == nil) @throw [OFInvalidArgumentException exception]; | > > > | | | 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | ![self directoryExistsAtURL: URL]) [self createDirectoryAtURL: URL]; } objc_autoreleasePoolPop(pool); } #ifdef OF_HAVE_FILES - (void)createDirectoryAtPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); [self createDirectoryAtURL: [OFURL fileURLWithPath: path]]; objc_autoreleasePoolPop(pool); } - (void)createDirectoryAtPath: (OFString *)path createParents: (bool)createParents { void *pool = objc_autoreleasePoolPush(); [self createDirectoryAtURL: [OFURL fileURLWithPath: path] createParents: createParents]; objc_autoreleasePoolPop(pool); } #endif - (OFArray OF_GENERIC(OFString *) *)contentsOfDirectoryAtURL: (OFURL *)URL { OFURLHandler *URLHandler; if (URL == nil) @throw [OFInvalidArgumentException exception]; if ((URLHandler = [OFURLHandler handlerForURL: URL]) == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; return [URLHandler contentsOfDirectoryAtURL: URL]; } #ifdef OF_HAVE_FILES - (OFArray OF_GENERIC(OFString *) *)contentsOfDirectoryAtPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); OFArray OF_GENERIC(OFString *) *ret; ret = [self contentsOfDirectoryAtURL: [OFURL fileURLWithPath: path]]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } - (void)changeCurrentDirectoryPath: (OFString *)path { if (path == nil) @throw [OFInvalidArgumentException exception]; # if defined(OF_WINDOWS) if (_wchdir(path.UTF16String) != 0) @throw [OFChangeCurrentDirectoryPathFailedException exceptionWithPath: path errNo: errno]; # elif defined(OF_AMIGAOS) BPTR lock, oldLock; if ((lock = Lock([path cStringWithEncoding: [OFLocale encoding]], SHARED_LOCK)) == 0) { int errNo; switch (IoErr()) { |
︙ | ︙ | |||
443 444 445 446 447 448 449 | if (!dirChanged) originalDirLock = oldLock; else UnLock(oldLock); dirChanged = true; | | | | 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | if (!dirChanged) originalDirLock = oldLock; else UnLock(oldLock); dirChanged = true; # else if (chdir([path cStringWithEncoding: [OFLocale encoding]]) != 0) @throw [OFChangeCurrentDirectoryPathFailedException exceptionWithPath: path errNo: errno]; # endif } - (void)changeCurrentDirectoryURL: (OFURL *)URL { void *pool = objc_autoreleasePoolPush(); [self changeCurrentDirectoryPath: URL.fileSystemRepresentation]; |
︙ | ︙ | |||
470 471 472 473 474 475 476 477 478 479 480 481 482 483 | void *pool = objc_autoreleasePoolPush(); [self copyItemAtURL: [OFURL fileURLWithPath: source] toURL: [OFURL fileURLWithPath: destination]]; objc_autoreleasePoolPop(pool); } - (void)copyItemAtURL: (OFURL *)source toURL: (OFURL *)destination { void *pool; OFURLHandler *URLHandler; of_file_attributes_t attributes; | > | 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | void *pool = objc_autoreleasePoolPush(); [self copyItemAtURL: [OFURL fileURLWithPath: source] toURL: [OFURL fileURLWithPath: destination]]; objc_autoreleasePoolPop(pool); } #endif - (void)copyItemAtURL: (OFURL *)source toURL: (OFURL *)destination { void *pool; OFURLHandler *URLHandler; of_file_attributes_t attributes; |
︙ | ︙ | |||
515 516 517 518 519 520 521 | if ([type isEqual: of_file_type_directory]) { OFArray *contents; @try { [self createDirectoryAtURL: destination]; | | | | | > | > > > | | | | | < > > > | 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | if ([type isEqual: of_file_type_directory]) { OFArray *contents; @try { [self createDirectoryAtURL: destination]; @try { of_file_attribute_key_t key = of_file_attribute_key_posix_permissions; OFNumber *permissions = [attributes objectForKey: key]; of_file_attributes_t destinationAttributes; if (permissions != nil) { destinationAttributes = [OFDictionary dictionaryWithObject: permissions forKey: key]; [self setAttributes: destinationAttributes ofItemAtURL: destination]; } } @catch (OFNotImplementedException *e) { } contents = [self contentsOfDirectoryAtURL: source]; } @catch (id e) { /* * Only convert exceptions to OFCopyItemFailedException * that have an errNo property. This covers all I/O * related exceptions from the operations used to copy |
︙ | ︙ | |||
586 587 588 589 590 591 592 | length = [sourceStream readIntoBuffer: buffer length: pageSize]; [destinationStream writeBuffer: buffer length: length]; } | | | | | > | > > > | | | | | < > > > < | 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 | length = [sourceStream readIntoBuffer: buffer length: pageSize]; [destinationStream writeBuffer: buffer length: length]; } @try { of_file_attribute_key_t key = of_file_attribute_key_posix_permissions; OFNumber *permissions = [attributes objectForKey: key]; of_file_attributes_t destinationAttributes; if (permissions != nil) { destinationAttributes = [OFDictionary dictionaryWithObject: permissions forKey: key]; [self setAttributes: destinationAttributes ofItemAtURL: destination]; } } @catch (OFNotImplementedException *e) { } } @catch (id e) { /* * Only convert exceptions to OFCopyItemFailedException * that have an errNo property. This covers all I/O * related exceptions from the operations used to copy * an item, all others should be left as is. */ if ([e respondsToSelector: @selector(errNo)]) @throw [OFCopyItemFailedException exceptionWithSourceURL: source destinationURL: destination errNo: [e errNo]]; @throw e; } @finally { [sourceStream close]; [destinationStream close]; free(buffer); } } else if ([type isEqual: of_file_type_symbolic_link]) { @try { OFString *linkDestination = attributes.fileSymbolicLinkDestination; [self createSymbolicLinkAtURL: destination withDestinationPath: linkDestination]; |
︙ | ︙ | |||
639 640 641 642 643 644 645 | @throw [OFCopyItemFailedException exceptionWithSourceURL: source destinationURL: destination errNo: [e errNo]]; @throw e; } | < > > | 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | @throw [OFCopyItemFailedException exceptionWithSourceURL: source destinationURL: destination errNo: [e errNo]]; @throw e; } } else @throw [OFCopyItemFailedException exceptionWithSourceURL: source destinationURL: destination errNo: EINVAL]; objc_autoreleasePoolPop(pool); } #ifdef OF_HAVE_FILES - (void)moveItemAtPath: (OFString *)source toPath: (OFString *)destination { void *pool = objc_autoreleasePoolPush(); [self moveItemAtURL: [OFURL fileURLWithPath: source] toURL: [OFURL fileURLWithPath: destination]]; objc_autoreleasePoolPop(pool); } #endif - (void)moveItemAtURL: (OFURL *)source toURL: (OFURL *)destination { void *pool; OFURLHandler *URLHandler; |
︙ | ︙ | |||
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | if ((URLHandler = [OFURLHandler handlerForURL: URL]) == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; [URLHandler removeItemAtURL: URL]; } - (void)removeItemAtPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); [self removeItemAtURL: [OFURL fileURLWithPath: path]]; objc_autoreleasePoolPop(pool); } - (void)linkItemAtURL: (OFURL *)source toURL: (OFURL *)destination { void *pool = objc_autoreleasePoolPush(); OFURLHandler *URLHandler; | > > | 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 | if ((URLHandler = [OFURLHandler handlerForURL: URL]) == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; [URLHandler removeItemAtURL: URL]; } #ifdef OF_HAVE_FILES - (void)removeItemAtPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); [self removeItemAtURL: [OFURL fileURLWithPath: path]]; objc_autoreleasePoolPop(pool); } #endif - (void)linkItemAtURL: (OFURL *)source toURL: (OFURL *)destination { void *pool = objc_autoreleasePoolPush(); OFURLHandler *URLHandler; |
︙ | ︙ | |||
827 828 829 830 831 832 833 | } - (unsigned int)retainCount { return OF_RETAIN_COUNT_MAX; } @end | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 | } - (unsigned int)retainCount { return OF_RETAIN_COUNT_MAX; } @end @implementation OFDictionary (FileAttributes) - (uintmax_t)fileSize { return [attributeForKeyOrException(self, of_file_attribute_key_size) uIntMaxValue]; } - (of_file_type_t)fileType { return attributeForKeyOrException(self, of_file_attribute_key_type); } - (uint16_t)filePOSIXPermissions { return [attributeForKeyOrException(self, of_file_attribute_key_posix_permissions) uInt16Value]; } - (uint32_t)filePOSIXUID { return [attributeForKeyOrException(self, of_file_attribute_key_posix_uid) uInt32Value]; } - (uint32_t)filePOSIXGID { return [attributeForKeyOrException(self, of_file_attribute_key_posix_gid) uInt32Value]; } - (OFString *)fileOwner { return attributeForKeyOrException(self, of_file_attribute_key_owner); } - (OFString *)fileGroup { return attributeForKeyOrException(self, of_file_attribute_key_group); } - (OFDate *)fileLastAccessDate { return attributeForKeyOrException(self, of_file_attribute_key_last_access_date); } - (OFDate *)fileModificationDate { return attributeForKeyOrException(self, of_file_attribute_key_modification_date); } - (OFDate *)fileStatusChangeDate { return attributeForKeyOrException(self, of_file_attribute_key_status_change_date); } - (OFString *)fileSymbolicLinkDestination { return attributeForKeyOrException(self, of_file_attribute_key_symbolic_link_destination); } @end |
Modified src/OFURLHandler.h from [c202459f8e] to [99d8a7ec4d].
︙ | ︙ | |||
11 12 13 14 15 16 17 | * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFFileManager.h" #import "OFObject.h" #import "OFString.h" OF_ASSUME_NONNULL_BEGIN @class OFArray OF_GENERIC(ObjectType); @class OFDate; @class OFStream; @class OFURL; /*! * @class OFURLHandler OFURLHandler.h ObjFW/OFURLHandler.h * * @brief A handler for a URL scheme. */ @interface OFURLHandler: OFObject { |
︙ | ︙ | |||
411 412 413 414 415 416 417 | * was not possible. Note that errors while performing a move are * reported via exceptions and not by returning false! */ - (bool)moveItemAtURL: (OFURL *)source toURL: (OFURL *)destination; @end | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 225 226 227 228 229 230 231 232 | * was not possible. Note that errors while performing a move are * reported via exceptions and not by returning false! */ - (bool)moveItemAtURL: (OFURL *)source toURL: (OFURL *)destination; @end OF_ASSUME_NONNULL_END |
Modified src/OFURLHandler.m from [097dcd213e] to [c82ad13c9f].
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFURLHandler.h" #import "OFNumber.h" #import "OFURL.h" #ifdef OF_HAVE_THREADS # import "OFMutex.h" #endif #ifdef OF_HAVE_FILES # import "OFURLHandler_file.h" #endif #if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_THREADS) # import "OFURLHandler_HTTP.h" #endif | > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFURLHandler.h" #import "OFDictionary.h" #import "OFNumber.h" #import "OFURL.h" #ifdef OF_HAVE_THREADS # import "OFMutex.h" #endif #ifdef OF_HAVE_FILES # import "OFURLHandler_file.h" #endif #if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_THREADS) # import "OFURLHandler_HTTP.h" #endif static OFMutableDictionary OF_GENERIC(OFString *, OFURLHandler *) *handlers; #ifdef OF_HAVE_THREADS static OFMutex *mutex; #endif @implementation OFURLHandler @synthesize scheme = _scheme; + (void)initialize { if (self != [OFURLHandler class]) return; |
︙ | ︙ | |||
238 239 240 241 242 243 244 245 | } - (bool)moveItemAtURL: (OFURL *)source toURL: (OFURL *)destination { return false; } @end | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 192 193 194 195 196 197 198 199 | } - (bool)moveItemAtURL: (OFURL *)source toURL: (OFURL *)destination { return false; } @end |
Modified src/OFURLHandler_file.m from [bad8975ada] to [57ac566b12].
︙ | ︙ | |||
688 689 690 691 692 693 694 | else if ([key isEqual: of_file_attribute_key_group]) [self of_setOwner: nil andGroup: object ofItemAtURL: URL attributeKey: key attributes: attributes]; else | | > > | 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | else if ([key isEqual: of_file_attribute_key_group]) [self of_setOwner: nil andGroup: object ofItemAtURL: URL attributeKey: key attributes: attributes]; else @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; } objc_autoreleasePoolPop(pool); } - (bool)fileExistsAtURL: (OFURL *)URL { |
︙ | ︙ |
Modified src/ObjFW.h from [51f4765bba] to [927e22debb].
︙ | ︙ | |||
60 61 62 63 64 65 66 67 68 | #import "OFGZIPStream.h" #import "OFLHAArchive.h" #import "OFLHAArchiveEntry.h" #import "OFTarArchive.h" #import "OFTarArchiveEntry.h" #import "OFZIPArchive.h" #import "OFZIPArchiveEntry.h" #ifdef OF_HAVE_FILES # import "OFFile.h" | > < | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | #import "OFGZIPStream.h" #import "OFLHAArchive.h" #import "OFLHAArchiveEntry.h" #import "OFTarArchive.h" #import "OFTarArchiveEntry.h" #import "OFZIPArchive.h" #import "OFZIPArchiveEntry.h" #import "OFFileManager.h" #ifdef OF_HAVE_FILES # import "OFFile.h" # import "OFINIFile.h" # import "OFSettings.h" #endif #ifdef OF_HAVE_SOCKETS # import "OFStreamSocket.h" # import "OFTCPSocket.h" # import "OFUDPSocket.h" |
︙ | ︙ |