ObjFW  Diff

Differences From Artifact [d5e09aa3e8]:

To Artifact [726f0b6ba9]:


541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
541
542
543
544
545
546
547






548
549
550
551
552
553
554







-
-
-
-
-
-







#endif

	if (source == nil || destination == nil)
		@throw [OFInvalidArgumentException exception];

	pool = objc_autoreleasePoolPush();

	if ([self directoryExistsAtPath: destination]) {
		OFArray *components = [OFArray arrayWithObjects:
		    destination, [source lastPathComponent], nil];
		destination = [OFString pathWithComponents: components];
	}

#ifndef _WIN32
	if (lstat([destination
		cStringWithEncoding: OF_STRING_ENCODING_NATIVE], &s) == 0) {
#else
	if (_wstat([destination UTF16String], &s) == 0) {
#endif
		errno = EEXIST;
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
671
672
673
674
675
676
677






678
679
680
681
682
683
684







-
-
-
-
-
-







	void *pool;

	if (source == nil || destination == nil)
		@throw [OFInvalidArgumentException exception];

	pool = objc_autoreleasePoolPush();

	if ([self directoryExistsAtPath: destination]) {
		OFArray *components = [OFArray arrayWithObjects:
		    destination, [source lastPathComponent], nil];
		destination = [OFString pathWithComponents: components];
	}

#ifndef _WIN32
	if (rename([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
	    [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE]))
#else
	if (_wrename([source UTF16String], [destination UTF16String]))
#endif
		@throw [OFRenameItemFailedException