Hi again,
Ok I seem to be having never ending problems here unfortunately. Using this
code (below) I thought I could modify it for my needs. But on the
FSPathMakeRef line I keep getting the warning that "pointer targets in passing
argument 1 of 'FSPathMakeRef' differ in signedness." Would someone mind
telling me why I'm getting this error? Thanks you very much!
- (NSDate *)creationDate:(NSString *)path
{
FSRef ref;
FSCatalogInfo catalogInfo;
OSStatus status;
OSErr err;
NSTimeInterval seconds;
NSCalendarDate *epoch = [NSCalendarDate dateWithYear:1904 month:1
day:1 hour:0 minute:0 second:0 timeZone:[NSTimeZone
timeZoneForSecondsFromGMT:0]];
status = FSPathMakeRef([path fileSystemRepresentation], &ref, nil);
if (status != noErr) {
NSLog(@"error making ref for %@: %d", path, status);
return nil;
}
err = FSGetCatalogInfo(&ref, kFSCatInfoCreateDate, &catalogInfo,
NULL, NULL, NULL);
if (err != noErr) {
NSLog(@"error getting catalog info: %d", err);
return nil;
}
seconds = (double)((unsigned long
long)catalogInfo.createDate.highSeconds << 32) +
(double)catalogInfo.createDate.lowSeconds +
(double)catalogInfo.createDate.fraction / 0xffff;
return [epoch addTimeInterval:seconds];
}
On Jul 9, 2011, at 3:40 PM, Gary L. Wade wrote:
> Using Core Services or OS, you can call FSGetCatalogInfo. Also, I recall
> things are different for stat under 64 bit, so you may want to make sure
> you're doing the right thing.
>
> - Gary L. Wade (Sent from my iPhone)
>
> On Jul 8, 2011, at 8:37 PM, "Rick C." <[email protected]> wrote:
>
>> Ok I have double-checked and the icon isn't actually the issue since I call
>> iconForFile: after using stat. With the original code I posted it just
>> gives me today's date. I can go into Finder and as an example I found a
>> file that has a Last Opened date of 2009 and when I run stat it gives me
>> today's date. So it looks like stat is definitely not working...
>>
>> Is there not an older Carbon method that was used for this before? Is the
>> only way by using spotlight metadata?
>>
>> On a related note...I just updated one of my drives to Lion GM and on that
>> drive I had a hard time to find a file with a different Last Opened date vs.
>> Last Modified. Makes me think the Last Opened date in Finder is coming from
>> spotlight metadata could that be true? If so then it looks like using the
>> spotlight metadata and just falling back on the modification date might be
>> the right way to go anyways???
>>
>>
>> On Jul 8, 2011, at 5:38 PM, Chris Ridd wrote:
>>
>>>
>>> On 8 Jul 2011, at 09:54, Rick C. wrote:
>>>
>>>> Sorry about that no I'm on Mac OS I was just sending the email from my
>>>> iPhone :-)
>>>>
>>>> Ok I double-checked and I think I am getting the same results as you are.
>>>> But iconForFile does not modify the Last Opened date that shows in Finder.
>>>> So the question is how do I get that besides using the spotlight metadata?
>>>
>>> Does the resource fork (where the icon lives) have a different set of
>>> timestamps from the data fork?
>>>
>>> Chris
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list ([email protected])
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/garywade%40desisoftsystems.com
>>
>> This email sent to [email protected]
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]