Differences From Artifact [7c47454fd6]:
- File
src/OFFileURLHandler.m
— part of check-in
[46588d658c]
at
2020-12-22 00:50:26
on branch trunk
— Don't use stat() on MorphOS
This would be another function that needs to be passed from the linklib
to the .library. (user: js, size: 36990) [annotate] [blame] [check-ins using] [more...]
To Artifact [5499dbdb21]:
- File src/OFFileURLHandler.m — part of check-in [1b82d3bf4f] at 2021-03-07 20:25:21 on branch trunk — *.m: Fold methods into one line where it fits (user: js, size: 36896) [annotate] [blame] [check-ins using] [more...]
1 | /* | < < | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | /* * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * 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. */ #include "config.h" #define _LARGEFILE64_SOURCE #include <errno.h> #include <math.h> #ifdef HAVE_DIRENT_H # include <dirent.h> #endif |
︙ | ︙ | |||
479 480 481 482 483 484 485 | errNo: errno]; destination = [OFString stringWithCString: destinationC encoding: encoding length: length]; key = of_file_attribute_key_symbolic_link_destination; | | < | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | errNo: errno]; destination = [OFString stringWithCString: destinationC encoding: encoding length: length]; key = of_file_attribute_key_symbolic_link_destination; [attributes setObject: destination forKey: key]; # else HANDLE handle; OFString *destination; if (func_CreateSymbolicLinkW == NULL) return; |
︙ | ︙ | |||
528 529 530 531 532 533 534 | 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; | | < | 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | 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]; # undef slrb } @finally { CloseHandle(handle); } # endif } #endif |
︙ | ︙ | |||
590 591 592 593 594 595 596 | if (of_stat(path, &s) != 0) return false; return S_ISDIR(s.st_mode); } | | < | 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | if (of_stat(path, &s) != 0) return false; return S_ISDIR(s.st_mode); } - (OFStream *)openItemAtURL: (OFURL *)URL mode: (OFString *)mode { void *pool = objc_autoreleasePoolPush(); OFFile *file = [[OFFile alloc] initWithPath: URL.fileSystemRepresentation mode: mode]; objc_autoreleasePoolPop(pool); |
︙ | ︙ | |||
1156 1157 1158 1159 1160 1161 1162 | mode: nil errNo: retrieveError()]; while (ExNext(lock, &fib)) { OFString *file = [[OFString alloc] initWithCString: fib.fib_FileName encoding: encoding]; | < < | 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 | mode: nil errNo: retrieveError()]; while (ExNext(lock, &fib)) { OFString *file = [[OFString alloc] initWithCString: fib.fib_FileName encoding: encoding]; @try { [files addObject: file]; } @finally { [file release]; } } # endif if (IoErr() != ERROR_NO_MORE_ENTRIES) @throw [OFReadFailedException exceptionWithObject: self requestedLength: 0 errNo: retrieveError()]; } @finally { UnLock(lock); } #else of_string_encoding_t encoding = [OFLocale encoding]; DIR *dir; if ((dir = opendir([path cStringWithEncoding: encoding])) == NULL) @throw [OFOpenItemFailedException exceptionWithURL: URL mode: nil errNo: errno]; # if !defined(HAVE_READDIR_R) && defined(OF_HAVE_THREADS) @try { |
︙ | ︙ | |||
1341 1342 1343 1344 1345 1346 1347 | errNo: retrieveError()]; #endif objc_autoreleasePoolPop(pool); } #ifdef OF_FILE_MANAGER_SUPPORTS_LINKS | | < | 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 | errNo: retrieveError()]; #endif objc_autoreleasePoolPop(pool); } #ifdef OF_FILE_MANAGER_SUPPORTS_LINKS - (void)linkItemAtURL: (OFURL *)source toURL: (OFURL *)destination { void *pool = objc_autoreleasePoolPush(); OFString *sourcePath, *destinationPath; if (source == nil || destination == nil) @throw [OFInvalidArgumentException exception]; |
︙ | ︙ | |||
1423 1424 1425 1426 1427 1428 1429 | errNo: retrieveError()]; # endif objc_autoreleasePoolPop(pool); } #endif | | < | 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 | errNo: retrieveError()]; # endif objc_autoreleasePoolPop(pool); } #endif - (bool)moveItemAtURL: (OFURL *)source toURL: (OFURL *)destination { void *pool; if (![source.scheme isEqual: _scheme] || ![destination.scheme isEqual: _scheme]) return false; |
︙ | ︙ |