Overview
Comment: | OFFileManager: Use native AmigaDOS APIs on MorphOS
This removes the last uses of the libnix wrappers from OFFileManager. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
769145b2a9cacfafe08e9abe0063374c |
User & Date: | js on 2017-06-11 03:01:13 |
Other Links: | manifest | tags |
Context
2017-06-11
| ||
11:12 | runtime/arc.m: Call -[copy] on block check-in: 1070063543 user: js tags: trunk | |
03:01 | OFFileManager: Use native AmigaDOS APIs on MorphOS check-in: 769145b2a9 user: js tags: trunk | |
02:34 | OFFile: Rework handle on MorphOS check-in: a9b2bd12eb user: js tags: trunk | |
Changes
Modified src/OFFileManager.m from [5c318ce949] to [41cdb732b4].
︙ | ︙ | |||
992 993 994 995 996 997 998 | objc_autoreleasePoolPop(pool); } - (void)moveItemAtPath: (OFString *)source toPath: (OFString *)destination { | < < < | > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < > > > | 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 | objc_autoreleasePoolPop(pool); } - (void)moveItemAtPath: (OFString *)source toPath: (OFString *)destination { of_stat_t s; if (source == nil || destination == nil) @throw [OFInvalidArgumentException exception]; if (of_lstat(destination, &s) == 0) @throw [OFMoveItemFailedException exceptionWithSourcePath: source destinationPath: destination errNo: EEXIST]; #if defined(OF_WINDOWS) void *pool = objc_autoreleasePoolPush(); if (_wrename([source UTF16String], [destination UTF16String]) != 0) { if (errno != EXDEV) @throw [OFMoveItemFailedException exceptionWithSourcePath: source destinationPath: destination errNo: errno]; #elif defined(OF_MORPHOS) of_string_encoding_t encoding = [OFLocalization encoding]; if (!Rename([source cStringWithEncoding: encoding], [destination cStringWithEncoding: encoding]) != 0) { LONG err; if ((err = IoErr()) != ERROR_RENAME_ACROSS_DEVICES) { int errNo; switch (err) { case ERROR_OBJECT_IN_USE: case ERROR_DISK_NOT_VALIDATED: errNo = EBUSY; break; case ERROR_OBJECT_EXISTS: errNo = EEXIST; break; case ERROR_OBJECT_NOT_FOUND: errNo = ENOENT; break; case ERROR_DISK_WRITE_PROTECTED: errNo = EROFS; break; default: errNo = 0; break; } @throw [OFMoveItemFailedException exceptionWithSourcePath: source destinationPath: destination errNo: errNo]; } #else of_string_encoding_t encoding = [OFLocalization encoding]; if (rename([source cStringWithEncoding: encoding], [destination cStringWithEncoding: encoding]) != 0) { if (errno != EXDEV) @throw [OFMoveItemFailedException exceptionWithSourcePath: source destinationPath: destination errNo: errno]; #endif @try { [self copyItemAtPath: source toPath: destination]; } @catch (OFCopyItemFailedException *e) { [self removeItemAtPath: destination]; |
︙ | ︙ | |||
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 | @throw [OFMoveItemFailedException exceptionWithSourcePath: source destinationPath: destination errNo: [e errNo]]; } } objc_autoreleasePoolPop(pool); } - (void)removeItemAtPath: (OFString *)path { void *pool; of_stat_t s; | > > | 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 | @throw [OFMoveItemFailedException exceptionWithSourcePath: source destinationPath: destination errNo: [e errNo]]; } } #ifdef OF_WINDOWS objc_autoreleasePoolPop(pool); #endif } - (void)removeItemAtPath: (OFString *)path { void *pool; of_stat_t s; |
︙ | ︙ | |||
1089 1090 1091 1092 1093 1094 1095 | [self removeItemAtPath: [path stringByAppendingPathComponent: item]]; objc_autoreleasePoolPop(pool2); } | > | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 | [self removeItemAtPath: [path stringByAppendingPathComponent: item]]; objc_autoreleasePoolPop(pool2); } #ifndef OF_MORPHOS # ifndef OF_WINDOWS if (rmdir([path cStringWithEncoding: [OFLocalization encoding]]) != 0) # else if (_wrmdir([path UTF16String]) != 0) # endif @throw [OFRemoveItemFailedException exceptionWithPath: path errNo: errno]; } else { # ifndef OF_WINDOWS if (unlink([path cStringWithEncoding: [OFLocalization encoding]]) != 0) # else if (_wunlink([path UTF16String]) != 0) # endif @throw [OFRemoveItemFailedException exceptionWithPath: path errNo: errno]; #endif } #ifdef OF_MORPHOS if (!DeleteFile( [path cStringWithEncoding: [OFLocalization encoding]])) { int errNo; switch (IoErr()) { case ERROR_OBJECT_IN_USE: case ERROR_DISK_NOT_VALIDATED: errNo = EBUSY; break; case ERROR_OBJECT_NOT_FOUND: errNo = ENOENT; break; case ERROR_DISK_WRITE_PROTECTED: errNo = EROFS; break; case ERROR_DELETE_PROTECTED: errNo = EACCES; break; default: errNo = 0; break; } @throw [OFRemoveItemFailedException exceptionWithPath: path errNo: errNo]; } #endif objc_autoreleasePoolPop(pool); } #ifdef OF_FILE_MANAGER_SUPPORTS_LINKS - (void)linkItemAtPath: (OFString *)source toPath: (OFString *)destination |
︙ | ︙ |