Doc based, QTKit app. When saving, the new filename updates in the active window titleBar. I would also like to display the newly saved filename string in a textField, somewhere else on the opened doc. The code successfully saves the new doc. However the lastPathComponent string doesn't update. Please advise?
thanks,
Paul
- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
NSURL *outputFileURL = [(NSURL *)contextInfo autorelease];
if (returnCode == NSOKButton) {
NSString *filename = [sheet filename];
[[NSFileManager defaultManager] moveItemAtPath:[outputFileURL path] toPath:filename error:nil];
NSString *path = [filename lastPathComponent];
[textField setStringValue:[path lastPathComponent]];
[[NSWorkspace sharedWorkspace] openFile:filename];
}
else {
[[NSFileManager defaultManager] removeItemAtPath:[outputFileURL path] error:nil];
}
}