Archives

All posts for the month November, 2010

A file in Finder can be hidden by one of three ways

1. File’s hidden bit is set.

2. File is in hidden file list in folder (.hidden file).

3. File has a “.” at beginning of name.

Beginning in 10.6 use NSURL for referencing files and accessing their metadata. Parsing these values with getResourceValue:forKey:error: using the NSURLIsHiddenKey. However this will not detect the hidden file if it is in the .hidden file. NSURL has a long list of key to get values out of the file’s metadata.

Prior to 10.6
Use LSCopyItemInfoForURL

Example

BOOL isInvisibleCFURL(CFURLRef inURL)
{
LSItemInfoRecord itemInfo;
LSCopyItemInfoForURL(inURL, kLSRequestAllFlags, &itemInfo);

BOOL isInvisible = itemInfo.flags & kLSItemInfoIsInvisible;
return isInvisible;
}

LSItemInfoRecord is a structure which contains the following

  • flags
  • filetype
  • creator
  • extension
  • iconFileName
  • kindID

flags is structure containing

  • kLSItemInfoIsPlainFile Item is a data file (and not, for example, a directory, volume, or UNIX symbolic link).

  • kLSItemInfoIsPackage  Item is a packaged directory.

Your ads will be inserted here by

Easy AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot OR
Suppress Placement Boxes.

  • kLSItemInfoIsApplication Item is a single-file or packaged application.

  • kLSItemInfoIsContainer Item is a directory (includes packages) or volume.

  • kLSItemInfoIsAliasFile Item is an alias file (includes symbolic links).

  • kLSItemInfoIsSymlink Item is a UNIX symbolic link.

  • kLSItemInfoIsInvisible Item is invisible, because either its name begins with a period or its isInvisible Finder flag is set.

  • kLSItemInfoIsNativeApp Item is an application that can run natively in Mac OS X.

  • kLSItemInfoIsClassicApp Item is an application that cannot run natively and must be launched in the Classic emulation environment.

  • kLSItemInfoAppPrefersNativeItem is an application that can run either natively or in the Classic emulation environment, but prefers to be launched natively. This flag is valid only when kLSItemInfoIsNativeApp is set.

  • kLSItemInfoAppPrefersClassic Item is an application that can run either natively or in the Classic emulation environment, but prefers to be launched in the Classic environment. This flag is valid only when kLSItemInfoIsNativeApp is set.

  • kLSItemInfoAppIsScriptable Item is an application that can be scripted.

  • kLSItemInfoIsVolume Item is the root directory of a volume or mount point.

  • kLSItemInfoExtensionIsHidden Item has a hidden filename extension.



I was a little out of the loop on this lately but apparently Apple removed the airprint support on the Snow Leopard update just prior to iOS4.2 release. However, you can enable it by using AirPrintHactivator.  In case you did not know, it allows you to print from iOS 4.2 devices to any printer connected on your network.