NSOpenPanel and ".app" fileType and aliases
NSOpenPanel and ".app" fileType and aliases
- Subject: NSOpenPanel and ".app" fileType and aliases
- From: Diggory Laycock <email@hidden>
- Date: Sat, 8 Dec 2001 14:42:20 +0000
Hi list:
I am using the code below when I want the user to select an application from
their volumes.
It works, but if the user selects an alias to an application then the NSOpenPanel
thinks that the alias is a folder (a gray triangle points to the next pane)
also the following in the console: "FSOpenIterator failed:-1407"
The only reference to this error is at
http://developer.apple.com/techpubs/
macosx/Carbon/Files/FileManager/File_Manager/ResultCodes/ResultCodes.html
and reads:
errFSNotAFolder -1407 : 'A parameter was expected to identify a folder, but
it identified some other kind of object (e.g., a file) instead. This implies
that the specified object exists, but is of the wrong type. For example, one
of the parameters to FSCreateFileUnicode is an FSRef of the directory where
the file will be created; if the FSRef actually refers to a file, this error
is returned.'
What am I doing wrong? should I re-write it to use file-type "APPL" instead?
Thanks, Diggory.
---------------------------------------------
{
int result;
MFICHelperApplication *theHelperApp;
NSArray *fileTypes = [NSArray arrayWithObject:@"app"]; // We Only want
to be able to select apps
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
[oPanel setAllowsMultipleSelection:NO];
[oPanel setResolvesAliases:NO]; // Changing this doesn't affect the problem.
result = [oPanel runModalForTypes: fileTypes];
// equivalent to runModalForDirectory:file:types: method, using nil for
both the filename and directory arguments.
// filename is the pre-selected file.
// directory is the starting directory - nil means the Applications Directory.
if (result == NSOKButton) // If we didn't press cancel.
{
doStuffWithThePath...