ObjFW  Diff

Differences From Artifact [469d33eabc]:

To Artifact [0c8ee7ced6]:


65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFLinkFailedException.h"
#import "OFLockFailedException.h"
#import "OFOpenFileFailedException.h"
#import "OFOutOfMemoryException.h"
#import "OFReadFailedException.h"
#import "OFRemoveFailedException.h"
#import "OFRenameFailedException.h"
#import "OFSeekFailedException.h"
#import "OFUnlockFailedException.h"
#import "OFWriteFailedException.h"

#import "autorelease.h"
#import "macros.h"








|
|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFLinkFailedException.h"
#import "OFLockFailedException.h"
#import "OFOpenFileFailedException.h"
#import "OFOutOfMemoryException.h"
#import "OFReadFailedException.h"
#import "OFRemoveItemFailedException.h"
#import "OFRenameItemFailedException.h"
#import "OFSeekFailedException.h"
#import "OFUnlockFailedException.h"
#import "OFWriteFailedException.h"

#import "autorelease.h"
#import "macros.h"

239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
#ifndef _WIN32
	if (mkdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
	    DIR_MODE))
#else
	if (_wmkdir([path UTF16String]))
#endif
		@throw [OFCreateDirectoryFailedException
		    exceptionWithPath: path];
}

+ (void)createDirectoryAtPath: (OFString*)path
		createParents: (bool)createParents
{
	void *pool;
	OFArray *pathComponents;







|







239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
#ifndef _WIN32
	if (mkdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
	    DIR_MODE))
#else
	if (_wmkdir([path UTF16String]))
#endif
		@throw [OFCreateDirectoryFailedException
		    exceptionWithDirectoryPath: path];
}

+ (void)createDirectoryAtPath: (OFString*)path
		createParents: (bool)createParents
{
	void *pool;
	OFArray *pathComponents;
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
{
#ifndef _WIN32
	if (chdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE]))
#else
	if (_wchdir([path UTF16String]))
#endif
		@throw [OFChangeCurrentDirectoryPathFailedException
		    exceptionWithPath: path];
}

+ (off_t)sizeOfFileAtPath: (OFString*)path
{
#ifndef _WIN32
	struct stat s;








|







360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
{
#ifndef _WIN32
	if (chdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE]))
#else
	if (_wchdir([path UTF16String]))
#endif
		@throw [OFChangeCurrentDirectoryPathFailedException
		    exceptionWithDirectoryPath: path];
}

+ (off_t)sizeOfFileAtPath: (OFString*)path
{
#ifndef _WIN32
	struct stat s;

550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571

572
573
574
575
576
577
578

#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 [OFRenameFailedException
		    exceptionWithSourcePath: source
			    destinationPath: destination];

	objc_autoreleasePoolPop(pool);
}

+ (void)removeItemAtPath: (OFString*)path
{
#ifndef _WIN32
	if (remove([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE]))
#else
	if (_wremove([path UTF16String]))
#endif
		@throw [OFRemoveFailedException exceptionWithPath: path];

}

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







|













|
>







550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579

#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
		    exceptionWithSourcePath: source
			    destinationPath: destination];

	objc_autoreleasePoolPop(pool);
}

+ (void)removeItemAtPath: (OFString*)path
{
#ifndef _WIN32
	if (remove([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE]))
#else
	if (_wremove([path UTF16String]))
#endif
		@throw [OFRemoveItemFailedException
		    exceptionWithItemPath: path];
}

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