Differences From Artifact [bdb65f91bc]:
- File src/OFFileManager.m — part of check-in [7341924ced] at 2016-07-04 21:40:14 on branch trunk — -[destinationOfSymbolicLinkAtPath:] for Windows (user: js, size: 25265) [annotate] [blame] [check-ins using]
To Artifact [c2a222bc22]:
- File
src/OFFileManager.m
— part of check-in
[06bcb21fc7]
at
2017-01-09 06:26:04
on branch trunk
— Add OFLocalization
This singleton gives access to all things locale, including the ability
to get localized strings.This also adds the OF_LOCALIZED() macro. Its first argument is an ID for
the string to be localized and its second argument is the fallback
string to be used if it cannot retrieve the localized string. Following
that are variable name / value pairs to be replaced in the localized
string.Getting translated strings is not implemented yet: Instead, it always
uses the fallback string.This also switches ofhttp to localized strings. (user: js, size: 25129) [annotate] [blame] [check-ins using]
︙ | |||
30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | + | #import "OFFileManager.h" #import "OFFile.h" #import "OFString.h" #import "OFArray.h" #import "OFDate.h" #import "OFSystemInfo.h" #import "OFLocalization.h" #ifdef OF_HAVE_THREADS # import "OFMutex.h" #endif #import "OFChangeCurrentDirectoryPathFailedException.h" #import "OFChangeOwnerFailedException.h" |
︙ | |||
95 96 97 98 99 100 101 | 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 | - - + + - - + + - - + + - - + + - - + + - - + + | int of_stat(OFString *path, of_stat_t *buffer) { #if defined(OF_WINDOWS) return _wstat64([path UTF16String], buffer); #elif defined(OF_HAVE_OFF64_T) |
︙ | |||
178 179 180 181 182 183 184 | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | - + | wchar_t *buffer = _wgetcwd(NULL, 0); #endif @try { #ifndef OF_WINDOWS ret = [OFString stringWithCString: buffer |
︙ | |||
259 260 261 262 263 264 265 | 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | - + | - (void)createDirectoryAtPath: (OFString*)path { if (path == nil) @throw [OFInvalidArgumentException exception]; #ifndef OF_WINDOWS |
︙ | |||
318 319 320 321 322 323 324 | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | - + | @throw [OFInvalidArgumentException exception]; files = [OFMutableArray array]; #ifndef OF_WINDOWS DIR *dir; |
︙ | |||
429 430 431 432 433 434 435 | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | - + - | - (void)changeCurrentDirectoryPath: (OFString*)path { if (path == nil) @throw [OFInvalidArgumentException exception]; #ifndef OF_WINDOWS |
︙ | |||
520 521 522 523 524 525 526 | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | - + | - (void)changePermissionsOfItemAtPath: (OFString*)path permissions: (mode_t)permissions { if (path == nil) @throw [OFInvalidArgumentException exception]; # ifndef OF_WINDOWS |
︙ | |||
550 551 552 553 554 555 556 | 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | - + - | @throw [OFStatItemFailedException exceptionWithPath: path errNo: errno]; # ifdef OF_HAVE_THREADS [passwdMutex lock]; @try { # endif |
︙ | |||
584 585 586 587 588 589 590 | 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | - + | uid_t uid = -1; gid_t gid = -1; of_string_encoding_t encoding; if (path == nil || (owner == nil && group == nil)) @throw [OFInvalidArgumentException exception]; |
︙ | |||
796 797 798 799 800 801 802 | 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | - + | if (of_lstat(destination, &s) == 0) @throw [OFCopyItemFailedException exceptionWithSourcePath: source destinationPath: destination errNo: EEXIST]; #ifndef OF_WINDOWS |
︙ | |||
880 881 882 883 884 885 886 | 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 | - + - + | [path stringByAppendingPathComponent: item]]; objc_autoreleasePoolPop(pool2); } #ifndef OF_WINDOWS if (rmdir([path cStringWithEncoding: |
︙ | |||
913 914 915 916 917 918 919 | 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 | - + | void *pool; of_string_encoding_t encoding; if (source == nil || destination == nil) @throw [OFInvalidArgumentException exception]; pool = objc_autoreleasePoolPush(); |
︙ | |||
956 957 958 959 960 961 962 | 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 | - + | void *pool; of_string_encoding_t encoding; if (source == nil || destination == nil) @throw [OFInvalidArgumentException exception]; pool = objc_autoreleasePoolPush(); |
︙ | |||
1002 1003 1004 1005 1006 1007 1008 | 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 | - + | char destination[PATH_MAX]; ssize_t length; of_string_encoding_t encoding; if (path == nil) @throw [OFInvalidArgumentException exception]; |
︙ |