ObjFW  Check-in [c52e685523]

Overview
Comment:OFFileManager: Replace remove with unlink / rmdir

remove() is supposed to delete both, files and directories, but
unfortunately, on Windows it only works for files. Since there is an if
on the type anyway, use unlink() / rmdir() instead.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c52e6855236a035c73630fc9914a24feb2cc1cc4863d6cc2981d61f04b1a183f
User & Date: js on 2016-07-03 18:22:12
Other Links: manifest | tags
Context
2016-07-03
19:04
Update buildsys check-in: 6f47d47ae6 user: js tags: trunk
18:22
OFFileManager: Replace remove with unlink / rmdir check-in: c52e685523 user: js tags: trunk
17:25
OFHTTPClient: Make sure / is not encoded in path check-in: df0769200f user: js tags: trunk
Changes

Modified src/OFFileManager.m from [3f6812e137] to [828aa0d8f5].

846
847
848
849
850
851
852
853
854









855
856
857
858
859
860
861

862

863
864
865
866
867
868
869
			void *pool2 = objc_autoreleasePoolPush();

			[self removeItemAtPath:
			    [path stringByAppendingPathComponent: item]];

			objc_autoreleasePoolPop(pool2);
		}
	}










#ifndef OF_WINDOWS
	if (remove([path cStringWithEncoding:
	    [OFSystemInfo native8BitEncoding]]) != 0)
#else
	if (_wremove([path UTF16String]) != 0)
#endif
		@throw [OFRemoveItemFailedException exceptionWithPath: path

								errNo: errno];


	objc_autoreleasePoolPop(pool);
}

#ifdef OF_HAVE_LINK
- (void)linkItemAtPath: (OFString*)source
		toPath: (OFString*)destination







|
|
>
>
>
>
>
>
>
>
>

|
|

|

|
>
|
>







846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
			void *pool2 = objc_autoreleasePoolPush();

			[self removeItemAtPath:
			    [path stringByAppendingPathComponent: item]];

			objc_autoreleasePoolPop(pool2);
		}

#ifndef OF_WINDOWS
		if (rmdir([path cStringWithEncoding:
		    [OFSystemInfo native8BitEncoding]]) != 0)
#else
		if (_wrmdir([path UTF16String]) != 0)
#endif
			@throw [OFRemoveItemFailedException
				exceptionWithPath: path
					    errNo: errno];
	} else {
#ifndef OF_WINDOWS
		if (unlink([path cStringWithEncoding:
		    [OFSystemInfo native8BitEncoding]]) != 0)
#else
		if (_wunlink([path UTF16String]) != 0)
#endif
			@throw [OFRemoveItemFailedException
			    exceptionWithPath: path
					errNo: errno];
	}

	objc_autoreleasePoolPop(pool);
}

#ifdef OF_HAVE_LINK
- (void)linkItemAtPath: (OFString*)source
		toPath: (OFString*)destination