ObjFW  Check-in [06c0c98e78]

Overview
Comment:OFFile: Make use of _wchmod on Windows.

Actually, this seems to do exactly what was done manually with
{Get,Set}FileAttributesW before.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 06c0c98e7897486a23682ec2daf2668157b5ac581ecf5caa46f2d2265b126579
User & Date: js on 2013-01-13 01:24:59
Other Links: manifest | tags
Context
2013-01-13
02:44
Documentation improvements. check-in: 2d33638be9 user: js tags: trunk
01:24
OFFile: Make use of _wchmod on Windows. check-in: 06c0c98e78 user: js tags: trunk
01:19
OFFile: Use _wrename() instead of MoveFileW(). check-in: 55d99d15e3 user: js tags: trunk
Changes

Modified src/OFFile.m from [214e7cf8ea] to [7dcc3acfc8].

391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428

#ifndef _PSP
+ (void)changeModeOfFileAtPath: (OFString*)path
			  mode: (mode_t)mode
{
# ifndef _WIN32
	if (chmod([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], mode))
		@throw [OFChangeFileModeFailedException
		    exceptionWithClass: self
				  path: path
				  mode: mode];
# else
	DWORD attributes = GetFileAttributesW([path UTF16String]);

	if (attributes == INVALID_FILE_ATTRIBUTES)
		@throw [OFChangeFileModeFailedException
		    exceptionWithClass: self
				  path: path
				  mode: mode];

	if ((mode / 100) & 2)
		attributes &= ~FILE_ATTRIBUTE_READONLY;
	else
		attributes |= FILE_ATTRIBUTE_READONLY;

	if (!SetFileAttributesW([path UTF16String], attributes))
		@throw [OFChangeFileModeFailedException
		    exceptionWithClass: self
				  path: path
				  mode: mode];
# endif
}
#endif

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







<
<
<
<

|
|
<




<
<
<
<
<
<
<
<
<
<
<
<







391
392
393
394
395
396
397




398
399
400

401
402
403
404












405
406
407
408
409
410
411

#ifndef _PSP
+ (void)changeModeOfFileAtPath: (OFString*)path
			  mode: (mode_t)mode
{
# ifndef _WIN32
	if (chmod([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], mode))




# else
	if (_wchmod([path UTF16String], mode))
# endif

		@throw [OFChangeFileModeFailedException
		    exceptionWithClass: self
				  path: path
				  mode: mode];












}
#endif

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