ObjFW  Diff

Differences From Artifact [f060fd2dab]:

To Artifact [e0f0d0594a]:


276
277
278
279
280
281
282
283
284


285
286
287
288
289
290
291
276
277
278
279
280
281
282


283
284
285
286
287
288
289
290
291







-
-
+
+








	pathComponents = [path pathComponents];
	enumerator = [pathComponents objectEnumerator];
	while ((component = [enumerator nextObject]) != nil) {
		void *pool2 = objc_autoreleasePoolPush();

		if (currentPath != nil)
			currentPath = [OFString
			    stringWithPath: currentPath, component, nil];
			currentPath = [currentPath
			    stringByAppendingPathComponent: component];
		else
			currentPath = component;

		if ([currentPath length] > 0 &&
		    ![OFFile directoryExistsAtPath: currentPath])
			[OFFile createDirectoryAtPath: currentPath];

521
522
523
524
525
526
527

528
529


530
531
532
533
534
535
536
537
521
522
523
524
525
526
527
528


529
530

531
532
533
534
535
536
537







+
-
-
+
+
-








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

	pool = objc_autoreleasePoolPush();

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

	override = [self fileExistsAtPath: destination];
	pageSize = [OFSystemInfo pageSize];

	if ((buffer = malloc(pageSize)) == NULL)
		@throw [OFOutOfMemoryException
579
580
581
582
583
584
585

586
587


588
589
590
591
592
593
594
595
579
580
581
582
583
584
585
586


587
588

589
590
591
592
593
594
595







+
-
-
+
+
-








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

	pool = objc_autoreleasePoolPush();

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

#ifndef _WIN32
	if (rename([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
	    [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE]))
#else
	if (_wrename([source UTF16String], [destination UTF16String]))
623
624
625
626
627
628
629

630
631


632
633
634
635
636
637
638
639
623
624
625
626
627
628
629
630


631
632

633
634
635
636
637
638
639







+
-
-
+
+
-








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

	pool = objc_autoreleasePoolPush();

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

	if (link([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
	    [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE]) != 0)
		@throw [OFLinkFailedException
		    exceptionWithSourcePath: source
			    destinationPath: destination];
650
651
652
653
654
655
656

657
658


659
660
661
662
663
664
665
666
650
651
652
653
654
655
656
657


658
659

660
661
662
663
664
665
666







+
-
-
+
+
-








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

	pool = objc_autoreleasePoolPush();

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

	if (symlink([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
	    [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE]) != 0)
		@throw [OFCreateSymbolicLinkFailedException
		    exceptionWithSourcePath: source
			    destinationPath: destination];