ObjFW  Check-in [9db4db82ed]

Overview
Comment:OFFileManager: Symlinks take a destination path
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9db4db82ed1f4aef89ba461bf36a7bfd39c693442ba6385535c48233a3477b58
User & Date: js on 2017-11-12 21:42:03
Other Links: manifest | tags
Context
2017-11-13
01:18
Add OFURLHandler check-in: 31e602a476 user: js tags: trunk
2017-11-12
21:42
OFFileManager: Symlinks take a destination path check-in: 9db4db82ed user: js tags: trunk
19:00
OFFileManager: Make all URL methods available check-in: 08fd4dc3bf user: js tags: trunk
Changes

Modified src/OFFileManager.h from [a8e45d5d1f] to [cba586493b].

529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
 * This method is not available for all URLs.
 *
 * @note On Windows, this requires at least Windows Vista and administrator
 *	 privileges!
 *
 * @param destination The URL to the item which should symbolically link to the
 *		      source
 * @param source The URL to the item for which a symbolic link should be
 *		 created
 */
- (void)createSymbolicLinkAtURL: (OFURL *)destination
	     withDestinationURL: (OFURL *)source;
@end

@interface OFDictionary (FileAttributes)
/*!
 * The @ref of_file_attribute_key_size key from the dictionary.
 *
 * Raises an @ref OFUndefinedKeyException if the key is missing.







|



|







529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
 * This method is not available for all URLs.
 *
 * @note On Windows, this requires at least Windows Vista and administrator
 *	 privileges!
 *
 * @param destination The URL to the item which should symbolically link to the
 *		      source
 * @param source The path to the item for which a symbolic link should be
 *		 created
 */
- (void)createSymbolicLinkAtURL: (OFURL *)destination
	    withDestinationPath: (OFString *)source;
@end

@interface OFDictionary (FileAttributes)
/*!
 * The @ref of_file_attribute_key_size key from the dictionary.
 *
 * Raises an @ref OFUndefinedKeyException if the key is missing.

Modified src/OFFileManager.m from [b1663cc4e4] to [344a7c8de0].

612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
# endif
		@throw [OFSetItemAttributesFailedException
		    exceptionWithPath: path
			   attributes: attributes
		      failedAttribute: of_file_attribute_key_posix_permissions
				errNo: errno];
#else
	@throw [OFNotImplementedException exceptionWithSelector: _cmd
							 object: self];
#endif
}

- (void)of_setOwner: (OFString *)owner
	   andGroup: (OFString *)group
       ofItemAtPath: (OFString *)path
       attributeKey: (of_file_attribute_key_t)attributeKey







|
<







612
613
614
615
616
617
618
619

620
621
622
623
624
625
626
# endif
		@throw [OFSetItemAttributesFailedException
		    exceptionWithPath: path
			   attributes: attributes
		      failedAttribute: of_file_attribute_key_posix_permissions
				errNo: errno];
#else
	OF_UNRECOGNIZED_SELECTOR

#endif
}

- (void)of_setOwner: (OFString *)owner
	   andGroup: (OFString *)group
       ofItemAtPath: (OFString *)path
       attributeKey: (of_file_attribute_key_t)attributeKey
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
	if (chown([path cStringWithEncoding: encoding], uid, gid) != 0)
		@throw [OFSetItemAttributesFailedException
		    exceptionWithPath: path
			   attributes: attributes
		      failedAttribute: attributeKey
				errNo: errno];
#else
	@throw [OFNotImplementedException exceptionWithSelector: _cmd
							 object: self];
#endif
}

- (void)setAttributes: (of_file_attributes_t)attributes
	 ofItemAtPath: (OFString *)path
{
	void *pool;







|
<







676
677
678
679
680
681
682
683

684
685
686
687
688
689
690
	if (chown([path cStringWithEncoding: encoding], uid, gid) != 0)
		@throw [OFSetItemAttributesFailedException
		    exceptionWithPath: path
			   attributes: attributes
		      failedAttribute: attributeKey
				errNo: errno];
#else
	OF_UNRECOGNIZED_SELECTOR

#endif
}

- (void)setAttributes: (of_file_attributes_t)attributes
	 ofItemAtPath: (OFString *)path
{
	void *pool;
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
	void *pool = objc_autoreleasePoolPush();

	[self linkItemAtPath: [source fileSystemRepresentation]
		      toPath: [destination fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);
#else
	@throw [OFNotImplementedException exceptionWithSelector: _cmd
							 object: self];
#endif
}

#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS
- (void)createSymbolicLinkAtPath: (OFString *)destination
	     withDestinationPath: (OFString *)source
{







|
<







1577
1578
1579
1580
1581
1582
1583
1584

1585
1586
1587
1588
1589
1590
1591
	void *pool = objc_autoreleasePoolPush();

	[self linkItemAtPath: [source fileSystemRepresentation]
		      toPath: [destination fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);
#else
	OF_UNRECOGNIZED_SELECTOR

#endif
}

#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS
- (void)createSymbolicLinkAtPath: (OFString *)destination
	     withDestinationPath: (OFString *)source
{
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
# endif

	objc_autoreleasePoolPop(pool);
}
#endif

- (void)createSymbolicLinkAtURL: (OFURL *)destination
	     withDestinationURL: (OFURL *)source
{
#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS
	void *pool = objc_autoreleasePoolPush();

	[self createSymbolicLinkAtPath: [destination fileSystemRepresentation]
		   withDestinationPath: [source fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);
#else
	@throw [OFNotImplementedException exceptionWithSelector: _cmd
							 object: self];
#endif
}
@end

@implementation OFDictionary (FileAttributes)
- (uintmax_t)fileSize
{







|





|



|
<







1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636

1637
1638
1639
1640
1641
1642
1643
# endif

	objc_autoreleasePoolPop(pool);
}
#endif

- (void)createSymbolicLinkAtURL: (OFURL *)destination
	    withDestinationPath: (OFString *)source
{
#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS
	void *pool = objc_autoreleasePoolPush();

	[self createSymbolicLinkAtPath: [destination fileSystemRepresentation]
		   withDestinationPath: source];

	objc_autoreleasePoolPop(pool);
#else
	OF_UNRECOGNIZED_SELECTOR

#endif
}
@end

@implementation OFDictionary (FileAttributes)
- (uintmax_t)fileSize
{