• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: what happend of the .hidden file in Tiger?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what happend of the .hidden file in Tiger?


  • Subject: Re: what happend of the .hidden file in Tiger?
  • From: James Bucanek <email@hidden>
  • Date: Sat, 27 Aug 2005 08:00:36 -0700

Mason Mark wrote on Saturday, August 27, 2005:

>
>On Aug 27, 2005, at 6:16 PM, Finlay Dobbie wrote:
>
>> On 27/08/05, James Bucanek <email@hidden> wrote:
>>
>>> This is news to me. I've never had any problem with LS until I ran
>>> your test code. Admittedly, I haven't really tested any of my code
>>> since Tiger, so maybe it's a 10.4 issue. Have you filed a bug report?
>>>
>>
>> I wouldn't be surprised if the problem was that it's resolving the
>> symlinks at /tmp, /var, /etc and so on to their corresponding
>> directories in /private, and then examining the target's HFS
>> attributes...
>>
>> The only errors you're getting are because you can't get FSRefs to
>> /.vol and /dev. If you use URLs rather than FSRefs then LS will
>> correctly report them as invisible.
>>
>>  -- Finlay
>
>
>Huh, that's an interesting theory! But, not all those files are
>symlinks.
>
>By "errors", in this case I meant "Launch Services reporting a
>different visibility than what shows up in the Finder", not the
>errors getting the FSRef. (Bad choice of words, I suppose.)
>

Finlay's theory might be right, I don't know. I kept wondering why Mason's code gave me so many wrong answers that were different from my own code, which I've been perfectly happy with for some time. The biggest difference that I could see is that I get my FSRefs via FSGetCatalogInfoBulk.

So I edited Mason's code snippet and got considerably different results. What follows is two runs of the code on my PowerBook. The first uses FSPathMakeRef and the second gets the FSRefs with FSGetCatalogInfoBulk. In the second run the only anomolies are mach and mach.sym. Everything else (and I actually tested a number of other directories) is correct and agrees exactly with what you see in the Finder. At first blush, it would appear that all of the differences are, indeed, sym links (which might be resolved by FSPathMakeRef) or mount points (which FSGetCatalogInfo wouldn't return in the first place).

So as far as I can tell, LS agrees with the Finder 100% of the time -- except for mach and mach.sym.

The modified code follows the two outputs, for those cut-and-paste programmers in the audience.


[Session started at 2005-08-27 07:36:41 -0700.]
2005-08-27 07:36:43.585 InvisibleTest[1435] Got an error for /.vol, skipping...
2005-08-27 07:36:43.594 InvisibleTest[1435] Got an error for /dev, skipping...
2005-08-27 07:36:43.682 InvisibleTest[1435] VISIBLE ITEMS: (
    "/Applications",
    "/Applications (Mac OS 9)",
    "/Developer",
    "/etc",
    "/Library",
    "/mach",
    "/mach.sym",
    "/man",
    "/Network",
    "/Previous Systems.localized",
    "/sw",
    "/System",
    "/System Folder",
    "/tmp",
    "/ToTheTrash Storage",
    "/Users",
    "/var"
)
2005-08-27 07:36:43.691 InvisibleTest[1435] INVISIBLE ITEMS: (
    "/.buildinstaller1.tmp",
    "/.DRM_Data",
    "/.DS_Store",
    "/.hidden",
    "/.hotfiles.btree",
    "/.Spotlight-V100",
    "/.Trashes",
    "/automount",
    "/bin",
    "/cores",
    "/Desktop",
    "/Desktop DB",
    "/Desktop DF",
    "/Desktop Folder",
    "/lost+found",
    "/mach_kernel",
    "/opt",
    "/private",
    "/sbin",
    "/Temporary Items",
    "/TheVolumeSettingsFolder",
    "/Trash",
    "/usr",
    "/Volumes"
)

InvisibleTest has exited with status 0.
[Session started at 2005-08-27 07:37:05 -0700.]
2005-08-27 07:37:09.741 InvisibleTest[1450] VISIBLE ITEMS: (
    "/Applications",
    "/Applications (Mac OS 9)",
    "/Developer",
    "/Library",
    "/mach",
    "/mach.sym",
    "/man",
    "/Previous Systems.localized",
    "/sw",
    "/System",
    "/System Folder",
    "/ToTheTrash Storage",
    "/Users"
)
2005-08-27 07:37:09.762 InvisibleTest[1450] INVISIBLE ITEMS: (
    "/.buildinstaller1.tmp",
    "/.DRM_Data",
    "/.DS_Store",
    "/.hidden",
    "/.hotfiles.btree",
    "/.Spotlight-V100",
    "/.Trashes",
    "/.vol",
    "/automount",
    "/bin",
    "/cores",
    "/Desktop",
    "/Desktop DB",
    "/Desktop DF",
    "/Desktop Folder",
    "/dev",
    "/etc",
    "/lost+found",
    "/mach_kernel",
    "/Network",
    "/opt",
    "/private",
    "/sbin",
    "/Temporary Items",
    "/TheVolumeSettingsFolder",
    "/tmp",
    "/Trash",
    "/usr",
    "/var",
    "/Volumes"
)

InvisibleTest has exited with status 0.

#import <Foundation/Foundation.h>

#define FSCatMETHOD 1

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    OSStatus err = -1;

#if FSCatMETHOD
    FSRef   rootDir;
    err = FSPathMakeRef((const UInt8 *)"/",&rootDir,NULL);
    if (err)
        {
        NSLog(@"FSPathMakeRef returned %d",err);
        return 1;
        }
    FSIterator  dirIterator;
    err = FSOpenIterator(&rootDir,kFSIterateFlat,&dirIterator);
    if (err)
        {
        NSLog(@"FSOpenIterator returned %d",err);
        return 1;
        }

    ItemCount       itemCount;
    FSRef           itemRef[100];   // just assume / has less than 100 entries
    HFSUniStr255    itemName[100];
    Boolean         changed;
    err = FSGetCatalogInfoBulk(dirIterator,100,&itemCount,&changed,kFSCatInfoNone,NULL,itemRef,NULL,itemName);
    if (err != errFSNoMoreItems)
        {
        NSLog(@"FSGetCatalogInfoBulk returned %d",err);
        return 1;
        }
#endif

    NSMutableArray *invisibleItems = [NSMutableArray array];
    NSMutableArray *visibleItems = [NSMutableArray array];
#if !FSCatMETHOD
    NSArray *contents = [[NSFileManager defaultManager] directoryContentsAtPath:@"/"];
    NSEnumerator *e = [contents objectEnumerator];
    NSString *path = nil;
#endif

#if FSCatMETHOD
    int i;
    for (i=0; i<itemCount; i++)
#else
    while (path = [e nextObject])
#endif
        {
        LSItemInfoRecord itemInfo;
#if FSCatMETHOD
        NSString* realpath = [@"/" stringByAppendingPathComponent:[NSString stringWithCharacters:itemName[i].unicode length:itemName[i].length]];
        err = LSCopyItemInfoForRef(&itemRef[i],kLSRequestAllInfo,&itemInfo);
#else
        FSRef itemRef;
        NSString *realpath  = [@"/" stringByAppendingPathComponent:path];
        err = FSPathMakeRef([realpath fileSystemRepresentation], &itemRef, NULL);
        err = err || LSCopyItemInfoForRef(&itemRef,kLSRequestAllInfo,&itemInfo);
#endif
        if (err != noErr)
            NSLog(@"Got an error for %@, skipping...", realpath);
        else if ((itemInfo.flags&kLSItemInfoIsInvisible) != 0)
            [invisibleItems addObject:realpath];
        else
            [visibleItems addObject:realpath];
    }

    NSLog(@"VISIBLE ITEMS: %@", visibleItems);
    NSLog(@"INVISIBLE ITEMS: %@", invisibleItems);

    [pool release];
    return 0;
}
--
James Bucanek
 _______________________________________________
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

  • Follow-Ups:
    • Re: what happend of the .hidden file in Tiger?
      • From: Greg <email@hidden>
References: 
 >Re: what happend of the .hidden file in Tiger? (From: Mason Mark <email@hidden>)

  • Prev by Date: Re: How to know and open Password protected pdf (like preview)
  • Next by Date: Apple crash reports
  • Previous by thread: Re: what happend of the .hidden file in Tiger?
  • Next by thread: Re: what happend of the .hidden file in Tiger?
  • Index(es):
    • Date
    • Thread