• 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: NSFileManager - isExecutableFileAtPath - seems to lie
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSFileManager - isExecutableFileAtPath - seems to lie


  • Subject: Re: NSFileManager - isExecutableFileAtPath - seems to lie
  • From: Douglas Davidson <email@hidden>
  • Date: Fri, 5 Jul 2002 09:40:04 -0700

Does anyone have any idea of how to accurately identify a path as an
application?

There are a number of subtle and slightly different notions we are dealing with here. First, there is the filesystem execute permission bit, which is what NSFileManager deals with. This is pretty much useless as an indication of the type of a file; for one thing, there are a number of broken tools which set large numbers of permission bits for arbitrary files, so the permission to execute does not by any means imply the ability to do so. Also, the execute permission bit for directories refers to permission to search, not permission to execute.

Second, there is the notion of a file being of an executable type, which again is not a simple question. Among files that could reasonably be called executables, the most obvious are Mach-o files, which include standalone executables, shared libraries, Mach-o bundle files, object files, etc. There are also PEF executables, which are not directly executable by the kernel, but can be executed using CFM; these include standalone executables, shared libraries, and plugins. There are also shell scripts, some of which are directly executable, and interpreted executables of other types, such as Java code (sometimes in a .jar), Applescripts, and so forth.

Finally, there is the question of applications, which is an entirely different matter. There are many executables (e.g., the files in /usr/bin or /usr/libexec) which could not reasonably be called applications; most applications, on the other hand, are bundled, and so are themselves directory hierarchies which contain one or more executable files.

Fortunately, for the purposes of presentation to the user, there is a fairly well-defined notion of an application. Like most notions having to do with presenting the filesystem to the user, it is defined by Launch Services, and that is the place you should look.

Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSFileManager - isExecutableFileAtPath - seems to lie
      • From: Ondra Cada <email@hidden>
    • Re: NSFileManager - isExecutableFileAtPath - seems to lie
      • From: Diggory Laycock <email@hidden>
References: 
 >Re: NSFileManager - isExecutableFileAtPath - seems to lie (From: Chris Ridd <email@hidden>)

  • Prev by Date: initialFirstResponder weirdness
  • Next by Date: Re: Doing action from subclassed button?
  • Previous by thread: Re: NSFileManager - isExecutableFileAtPath - seems to lie
  • Next by thread: Re: NSFileManager - isExecutableFileAtPath - seems to lie
  • Index(es):
    • Date
    • Thread