ObjFW  Diff

Differences From Artifact [952a84375d]:

To Artifact [4da01770ca]:


701
702
703
704
705
706
707







708
709





































710
711
712
713
714
715
716


717
718
719
720
721
722
723
			    destinationPath: destination];

	objc_autoreleasePoolPop(pool);
}

+ (void)removeItemAtPath: (OFString*)path
{







	if (path == nil)
		@throw [OFInvalidArgumentException exception];






































#ifndef _WIN32
	if (remove([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE]))
#else
	if (_wremove([path UTF16String]))
#endif
		@throw [OFRemoveItemFailedException exceptionWithPath: path];


}

#ifdef OF_HAVE_LINK
+ (void)linkItemAtPath: (OFString*)source
		toPath: (OFString*)destination
{
	void *pool;







>
>
>
>
>
>
>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







>
>







701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
			    destinationPath: destination];

	objc_autoreleasePoolPop(pool);
}

+ (void)removeItemAtPath: (OFString*)path
{
	void *pool;
#ifndef _WIN32
	struct stat s;
#else
	struct _stat s;
#endif

	if (path == nil)
		@throw [OFInvalidArgumentException exception];

	pool = objc_autoreleasePoolPush();

#ifndef _WIN32
	if (lstat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], &s))
#else
	if (_wstat([path UTF16String], &s))
#endif
		@throw [OFRemoveItemFailedException exceptionWithPath: path];

	if (S_ISDIR(s.st_mode)) {
		OFArray *contents;
		OFEnumerator *enumerator;
		OFString *item;

		@try {
			contents = [OFFile contentsOfDirectoryAtPath: path];
		} @catch (id e) {
			@throw [OFRemoveItemFailedException
			    exceptionWithPath: path];
		}

		enumerator = [contents objectEnumerator];
		while ((item = [enumerator nextObject]) != nil) {
			void *pool2 = objc_autoreleasePoolPush();
			OFArray *components;
			OFString *itemPath;

			components = [OFArray arrayWithObjects:
			    path, item, nil];
			itemPath = [OFString pathWithComponents: components];

			[OFFile removeItemAtPath: itemPath];

			objc_autoreleasePoolPop(pool2);
		}
	}

#ifndef _WIN32
	if (remove([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE]))
#else
	if (_wremove([path UTF16String]))
#endif
		@throw [OFRemoveItemFailedException exceptionWithPath: path];

	objc_autoreleasePoolPop(pool);
}

#ifdef OF_HAVE_LINK
+ (void)linkItemAtPath: (OFString*)source
		toPath: (OFString*)destination
{
	void *pool;