Differences From Artifact [06f45f3b90]:
- File src/OFFileIRIHandler.m — part of check-in [0c471da638] at 2023-04-24 22:04:23 on branch trunk — Avoid redefinition of _LARGEFILE64_SOURCE (user: js, size: 40866) [annotate] [blame] [check-ins using]
To Artifact [624183587b]:
- File
src/OFFileIRIHandler.m
— part of check-in
[6d93db9f98]
at
2023-07-15 16:12:34
on branch trunk
— Add support for GNU/Hurd
Hurd does not have PATH_MAX, so different APIs need to be used on Hurd. (user: js, size: 41675) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #ifdef OF_WINDOWS # include <utime.h> #endif #ifdef OF_DJGPP # include <syslimits.h> #endif #ifdef HAVE_PWD_H # include <pwd.h> #endif #ifdef HAVE_GRP_H # include <grp.h> #endif | > > > | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #ifdef OF_WINDOWS # include <utime.h> #endif #ifdef OF_DJGPP # include <syslimits.h> #endif #ifdef HAVE_FCNTL_H # include <fcntl.h> #endif #ifdef HAVE_PWD_H # include <pwd.h> #endif #ifdef HAVE_GRP_H # include <grp.h> #endif |
︙ | ︙ | |||
467 468 469 470 471 472 473 | #ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS static void setSymbolicLinkDestinationAttribute(OFMutableFileAttributes attributes, OFIRI *IRI) { OFString *path = IRI.fileSystemRepresentation; | | < < < < < < < < < < < < < < < < < < < < | 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | #ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS static void setSymbolicLinkDestinationAttribute(OFMutableFileAttributes attributes, OFIRI *IRI) { OFString *path = IRI.fileSystemRepresentation; # ifdef OF_WINDOWS HANDLE handle; OFString *destination; if (createSymbolicLinkWFuncPtr == NULL) return; if ((handle = CreateFileW(path.UTF16String, 0, (FILE_SHARE_READ | |
︙ | ︙ | |||
538 539 540 541 542 543 544 545 546 547 548 549 550 551 | forKey: OFFileType]; [attributes setObject: destination forKey: OFFileSymbolicLinkDestination]; # undef slrb } @finally { CloseHandle(handle); } # endif } #endif #ifdef OF_FILE_MANAGER_SUPPORTS_EXTENDED_ATTRIBUTES static void setExtendedAttributes(OFMutableFileAttributes attributes, OFIRI *IRI) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 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 | forKey: OFFileType]; [attributes setObject: destination forKey: OFFileSymbolicLinkDestination]; # undef slrb } @finally { CloseHandle(handle); } # elif defined(OF_HURD) OFStringEncoding encoding = [OFLocale encoding]; int fd; OFMutableData *destinationData; OFString *destination; fd = open([path cStringWithEncoding: encoding], O_RDONLY | O_NOLINK); if (fd == -1) @throw [OFGetItemAttributesFailedException exceptionWithIRI: IRI errNo: errno]; @try { char buffer[512]; ssize_t length; destinationData = [OFMutableData data]; while ((length = read(fd, buffer, 512)) > 0) [destinationData addItems: buffer count: length]; } @finally { close(fd); } destination = [OFString stringWithCString: destinationData.items encoding: encoding length: destinationData.count]; [attributes setObject: destination forKey: OFFileSymbolicLinkDestination]; # else OFStringEncoding encoding = [OFLocale encoding]; char destinationC[PATH_MAX]; ssize_t length; OFString *destination; length = readlink([path cStringWithEncoding: encoding], destinationC, PATH_MAX); if (length < 0) @throw [OFGetItemAttributesFailedException exceptionWithIRI: IRI errNo: errno]; destination = [OFString stringWithCString: destinationC encoding: encoding length: length]; [attributes setObject: destination forKey: OFFileSymbolicLinkDestination]; # endif } #endif #ifdef OF_FILE_MANAGER_SUPPORTS_EXTENDED_ATTRIBUTES static void setExtendedAttributes(OFMutableFileAttributes attributes, OFIRI *IRI) |
︙ | ︙ |