Re: testing for invisible files in a file browser
Re: testing for invisible files in a file browser
- Subject: Re: testing for invisible files in a file browser
- From: Michele Balistreri <email@hidden>
- Date: Wed, 9 Aug 2006 20:38:45 +0200
Well, i link to Cocoa, but i believe it is defined in the
ApplicationServices framework, so try adding -framework
ApplicationServices
Il giorno 09/ago/06, alle ore 20:32, Tyler Riddle ha scritto:
Thanks!
Do you know what you have to link against to make this code work?
I'm getting
/usr/bin/ld: Undefined symbols:
_LSCopyItemInfoForURL
when compiling with
gcc -framework Foundation -framework CoreServices hidden.m -o hidden
Tyler
On 8/9/06, Michele Balistreri <email@hidden> wrote:
I wrote this code long ago that apparently catches all the invisible
files
- (BOOL)isInvisibleFileAtPath:(NSString *)path
{
BOOL isHidden = NO;
LSItemInfoRecord itemInfo;
LSCopyItemInfoForURL((CFURLRef)[NSURL URLWithString:path],
kLSRequestAllFlags, &itemInfo);
isHidden |= (itemInfo.flags & kLSItemInfoIsInvisible);
FSRef possibleInvisibleFile;
FSCatalogInfo catalogInfo;
FSPathMakeRef((unsigned const char *)[path
fileSystemRepresentation], &possibleInvisibleFile, nil);
FSGetCatalogInfo(&possibleInvisibleFile,
kFSCatInfoFinderInfo,
&catalogInfo, nil, nil, nil);
isHidden |= (((FileInfo*)catalogInfo.finderInfo)-
>finderFlags &
kIsInvisible) ? 1 : 0;
isHidden |= [path isEqualToString:@"/Network"];
isHidden |= [path isEqualToString:@"/mach"];
isHidden |= [path isEqualToString:@"/mach.sym"];
isHidden |= [path isEqualToString:@"/dev"];
return isHidden;
}
Feel free to use it, i guess is not under public domain :)
Il giorno 09/ago/06, alle ore 08:54, René van Amerongen ha scritto:
>
> Op 9-aug-2006, om 1:58 heeft Nick Zitzmann het volgende geschreven:
>
>>
>> On Aug 8, 2006, at 5:17 PM, Tyler Riddle wrote:
>>
>>> For instance,
>>> when pointed at /etc (which is invisible to the finder on my
>>> machine),
>>> the returned value indicates the folder is visible. I'm at a
loss as
>>> to why the code does not work. Can anyone provide some insight?
>>
>> In addition to what was already mentioned, there are three
>> different ways that a file may be marked as invisible:
>> 1. The Finder metadata has the hidden bit set
>> 2. The file/folder is listed in the .hidden file, if present
>
> So far as I can see is .hidden in Tiger obsolete, but the existing
> one's are respected.
>
>> 3. The file/folder name begins with a period
>>
>> /etc is covered by case #2. You'll have to check for all three
>> cases on each file you wish to test.
>
> with what is /etc covered in Tiger? Because I have none .hidden
>
> Thanks
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> 40briksoftware.com
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40tylerriddle.com
This email sent to email@hidden
--
Quote: "You need only reflect that one of the best ways to get
yourself a reputation as a dangerous citizen these days is to go about
repeating the very phrases which our founding fathers used in the
struggle for independence."--Charles Austin Beard
Web site: http://tylerriddle.com
AIM: The Masta Spice
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden