aneuryzm
aneuryzm

Reputation: 64834

My NSSavePanel is not saving the file. (OSX 10.5)

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

Answers (2)

Michael Krelin - hacker
Michael Krelin - hacker

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

Justin Boo
Justin Boo

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

Related Questions