Reputation: 64834
My NSSavePanel is not saving the file. I'm building an app for OSX 10.5
NSSavePanel *createPanel = [[NSSavePanel alloc] init];
[createPanel setCanCreateDirectories:YES];
int result = [createPanel runModal];
if (result == 1) {
[lyricsFileField setStringValue:[createPanel filename]];
}
I manually type the file name and I select the directory but the file is not saved.
Thanks
ps. How do I pass a file path to the panel ? (setNameFieldStringValue: is for > 10.6 only.)
Upvotes: 0
Views: 264
Reputation: 143091
NSSavePanel
is not supposed to save file, it is for selecting the file, for what I know.
And there's a directory
and filename
properties or some such prior to 10.6.
Upvotes: 1
Reputation: 10198
You are not saving any file, You just change text in Your textField to Your location string. If You want to save the file You need to use this:
[data writeToFile:[createPanel filename] atomically: NO];
instead:
[lyricsFileField setStringValue:[createPanel filename]];
Upvotes: 1