Re: NSFileManager vs Non-Packaged application: 0 - 1
Re: NSFileManager vs Non-Packaged application: 0 - 1
- Subject: Re: NSFileManager vs Non-Packaged application: 0 - 1
- From: Bob Ippolito <email@hidden>
- Date: Mon, 7 Mar 2005 07:19:59 -0500
On Mar 7, 2005, at 6:35, stephane sudre wrote:
It looks there is a bug in either the NSFileManager code or
documentation:
According to the documentation:
------------8<--------------8<--------------8<--------------
isExecutableFileAtPath:
- (BOOL)isExecutableFileAtPath:(NSString *)path
Returns YES if the underlying operating system appears able to execute
the file specified in path and NO if it cannot. This method traverses
symbolic links.
If the file at path does not exist, this method returns NO.
------------8<--------------8<--------------8<--------------
Well, this does not really apply to the real world.
If the application (RealBasic or Carbon non packaged) does not have
its execute flags set, the result will be no.
YET the operating system is able to execute the file specified in path
as you can double-click it in the Finder and it will get launched.
--------8<-----------8<------------8<------------
Is there any official solution to know if a file is an executable?
Of course, I could read the 8 first bytes of the file and see if it
starts with Joy!peff or 0xfeedface but since the code can be in a
resource in the first case....
Not all executable files are Mach-O or CFM. It could be a shell
script, or a fat Mach-O file (which is 0xcafebabe, IIRC).
The documentation is correct, so is the implementation. The
**underlying operating system** does NOT execute CFM files. They're
treated more like documents that are handled by LaunchCFMApp. If there
is a function to see if the given path is an "application", it would be
in LaunchServices.
-bob
_______________________________________________
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