ObjFW  Check-in [53e9c74096]

Overview
Comment:OFFileURLHandler: Move things around a little
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | set-mtime
Files: files | file ages | folders
SHA3-256: 53e9c740969e4f765e2573a9b05a4e890b616da5c961dc6ac98e75d541d2c5a8
User & Date: js on 2020-06-01 21:02:59
Other Links: branch diff | manifest | tags
Context
2020-06-02
21:02
ofarc: Set modification date of extracted files check-in: bc158ffe75 user: js tags: set-mtime
2020-06-01
21:02
OFFileURLHandler: Move things around a little check-in: 53e9c74096 user: js tags: set-mtime
19:09
OFFileURLHandler: Support setting atime and mtime check-in: c6b128a2f9 user: js tags: set-mtime
Changes

Modified src/OFFileURLHandler.m from [07cc67658d] to [9591e49fd5].

607
608
609
610
611
612
613
614
615
616
617








618
619
620
621
622
623
624

	return ret;
}

- (void)of_setLastAccessDate: (OFDate *)lastAccessDate
	 andModificationDate: (OFDate *)modificationDate
		 ofItemAtURL: (OFURL *)URL
		attributeKey: (of_file_attribute_key_t)attributeKey
		  attributes: (of_file_attributes_t)attributes
{
	OFString *path = URL.fileSystemRepresentation;









#ifdef OF_WINDOWS
	if (func__wutime64 != NULL) {
		struct __utimbuf64 times = {
			.actime =
			    (__time64_t)lastAccessDate.timeIntervalSince1970,
			.modtime =







<



>
>
>
>
>
>
>
>







607
608
609
610
611
612
613

614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631

	return ret;
}

- (void)of_setLastAccessDate: (OFDate *)lastAccessDate
	 andModificationDate: (OFDate *)modificationDate
		 ofItemAtURL: (OFURL *)URL

		  attributes: (of_file_attributes_t)attributes
{
	OFString *path = URL.fileSystemRepresentation;
	of_file_attribute_key_t attributeKey = (modificationDate != nil
	    ? of_file_attribute_key_modification_date
	    : of_file_attribute_key_last_access_date);

	if (lastAccessDate == nil)
		lastAccessDate = modificationDate;
	if (modificationDate == nil)
		modificationDate = lastAccessDate;

#ifdef OF_WINDOWS
	if (func__wutime64 != NULL) {
		struct __utimbuf64 times = {
			.actime =
			    (__time64_t)lastAccessDate.timeIntervalSince1970,
			.modtime =
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
	}

	lastAccessDate = [attributes
	    objectForKey: of_file_attribute_key_last_access_date];
	modificationDate = [attributes
	    objectForKey: of_file_attribute_key_modification_date];

	if (lastAccessDate != nil || modificationDate != nil) {
		of_file_attribute_key_t attributeKey;

		if (modificationDate != nil)
			attributeKey = of_file_attribute_key_modification_date;
		else
			attributeKey = of_file_attribute_key_last_access_date;

		if (lastAccessDate == nil)
			lastAccessDate = modificationDate;
		if (modificationDate == nil)
			modificationDate = lastAccessDate;

		[self of_setLastAccessDate: lastAccessDate
		       andModificationDate: modificationDate
			       ofItemAtURL: URL
			      attributeKey: attributeKey
				attributes: attributes];
	}

	objc_autoreleasePoolPop(pool);
}

- (bool)fileExistsAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();







|
<
<
<
<
<
<
<
<
<
<
<
<



<

<







827
828
829
830
831
832
833
834












835
836
837

838

839
840
841
842
843
844
845
	}

	lastAccessDate = [attributes
	    objectForKey: of_file_attribute_key_last_access_date];
	modificationDate = [attributes
	    objectForKey: of_file_attribute_key_modification_date];

	if (lastAccessDate != nil || modificationDate != nil)












		[self of_setLastAccessDate: lastAccessDate
		       andModificationDate: modificationDate
			       ofItemAtURL: URL

				attributes: attributes];


	objc_autoreleasePoolPop(pool);
}

- (bool)fileExistsAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();