Overview
Comment: | Add +[changeToDirectory:] to OFFile. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
4cf36480979d8f1cbdc36cbb2f23257b |
User & Date: | js on 2010-12-20 21:41:22 |
Other Links: | manifest | tags |
Context
2010-12-23
| ||
18:16 | Add +[componentsOfPath:] and +[directoryNameOfPath:] to OFFile. check-in: 1e52247065 user: js tags: trunk | |
2010-12-20
| ||
21:41 | Add +[changeToDirectory:] to OFFile. check-in: 4cf3648097 user: js tags: trunk | |
21:39 | Adjust exceptions to recent change to +[className]. check-in: a655029b6d user: js tags: trunk | |
Changes
Modified src/OFExceptions.h from [cf0e8b7f35] to [47fe40eae4].
︙ | ︙ | |||
424 425 426 427 428 429 430 | /** * \return The errno from when the exception was created */ - (int)errNo; /** | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /** * \return The errno from when the exception was created */ - (int)errNo; /** * \return A string with the path of the directory which couldn't be created */ - (OFString*)path; @end /** * \brief An exception indicating changing to a directory failed */ @interface OFChangeDirectoryFailedException: OFException { OFString *path; int errNo; } #ifdef OF_HAVE_PROPERTIES @property (readonly, nonatomic) OFString *path; @property (readonly) int errNo; #endif /** * \param class_ The class of the object which caused the exception * \param path A string with the path of the directory to which couldn't be * changed * \return A new change directory failed exception */ + newWithClass: (Class)class_ path: (OFString*)path; /** * Initializes an already allocated change directory failed exception. * * \param class_ The class of the object which caused the exception * \param path A string with the path of the directory to which couldn't be * changed * \return An initialized change directory failed exception */ - initWithClass: (Class)class_ path: (OFString*)path; /** * \return The errno from when the exception was created */ - (int)errNo; /** * \return A string with the path of the directory to which couldn't changed */ - (OFString*)path; @end /** * \brief An exception indicating that changing the mode of a file failed. */ |
︙ | ︙ |
Modified src/OFExceptions.m from [f318889e33] to [304001534e].
︙ | ︙ | |||
659 660 661 662 663 664 665 666 667 668 669 670 671 672 | if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to create directory %s in class %s! " ERRFMT, [path cString], class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 | if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to create directory %s in class %s! " ERRFMT, [path cString], class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; } - (OFString*)path { return path; } @end @implementation OFChangeDirectoryFailedException + newWithClass: (Class)class_ path: (OFString*)path_ { return [[self alloc] initWithClass: class_ path: path_]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; @throw [OFNotImplementedException newWithClass: c selector: _cmd]; } - initWithClass: (Class)class_ path: (OFString*)path_ { self = [super initWithClass: class_]; @try { path = [path_ copy]; errNo = GET_ERRNO; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [path release]; [super dealloc]; } - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to change to directory %s in class %s! " ERRFMT, [path cString], class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; } |
︙ | ︙ |
Modified src/OFFile.h from [59c7528bbb] to [905b14b0b8].
︙ | ︙ | |||
68 69 70 71 72 73 74 75 76 77 78 79 80 81 | /** * \param path The path of the directory * \return An array of OFStrings with the files at the specified path */ + (OFArray*)filesInDirectoryAtPath: (OFString*)path; /** * Changes the mode of a file. * * Only changes read-only flag on Windows. * * \param path The path to the file of which the mode should be changed as a * string | > > > > > > > | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | /** * \param path The path of the directory * \return An array of OFStrings with the files at the specified path */ + (OFArray*)filesInDirectoryAtPath: (OFString*)path; /** * Changes the current working directory. * * \param path The new directory to change to */ + (void)changeToDirectory: (OFString*)path; /** * Changes the mode of a file. * * Only changes read-only flag on Windows. * * \param path The path to the file of which the mode should be changed as a * string |
︙ | ︙ |
Modified src/OFFile.m from [71e165dd8a] to [213cb19bf6].
︙ | ︙ | |||
270 271 272 273 274 275 276 277 278 279 280 281 282 283 | } @finally { FindClose(handle); } #endif return files; } + (void)changeModeOfFile: (OFString*)path toMode: (mode_t)mode { #ifndef _WIN32 if (chmod([path cString], mode)) @throw [OFChangeFileModeFailedException newWithClass: self | > > > > > > > | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | } @finally { FindClose(handle); } #endif return files; } + (void)changeToDirectory: (OFString*)path { if (chdir([path cString])) @throw [OFChangeDirectoryFailedException newWithClass: self path: path]; } + (void)changeModeOfFile: (OFString*)path toMode: (mode_t)mode { #ifndef _WIN32 if (chmod([path cString], mode)) @throw [OFChangeFileModeFailedException newWithClass: self |
︙ | ︙ |