On Jun 11, 2005, at 6:29 PM, Theodore H. Smith wrote:
From: Eric Brunstad
What you are doing is wrong.
Do this instead:
[sp setAllowedFileTypes:[NSArray arrayWithObjects:@"htm",@"html"]];
[sp setCanSelectHiddenExtension:YES];
runResult = [sp runModalForDirectory:nil file:@"untitled.htm"];
The reason why you must do this is becuase Cocoa must know what extension to slap on the name when the checkbox is selected.
Hi Eric,
What I am trying to do, is provide a default file extension, but allow them to change the extension as they like. For HTML, this isn't so bad, because there are a variety of html extensions (.html, .htm, .shtml, etc). Sometimes HTML comes with no file extension, even.
For example "MyHTMLFileName" and "MyHTMLFileName.html" are both perfectly valid HTML file names.
Should I just forget the whole filetypes thing in such a case, and just specify a filetype of nil, and also not even allow them to hide the extension?