discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: accessing/setting file name for NSSavePanel


From: Wolfgang Lux
Subject: Re: accessing/setting file name for NSSavePanel
Date: Sat, 28 Nov 2009 15:35:37 +0100

Hi Riccardo,

I was already using setRequirtedFileType. But as you write, the extension is not shown automatically. Furthermore two things confuse: the first call to the change extension won't actually change it..., the second yes.

-setRequiredFileType: at present changes the extension of the file name only if it matches the current required extension (or more generally one of the allowed extensions). If the name's current extension is different it will not change. So if you have a file name ending with a wrong extension, then call -setRequiredFileType: with the name's current extension and then call -setRequiredFileType: again it would change. In all other cases it shouldn't change. This may be confusing, but I think this was the behavior on OS X when I last touched the NSSavePanel code. On the other hand, Apple's stance on multiple file name extensions has changed over time, so it may no longer match the current behavior.

Thus when just opening a file with a certain extension, trying to save it with another file type would try to add a second extension. Mac warns about that. But the new extension wasn't been shown.

I agree that a warning would be very useful here. If I find time, I'll try to add it.

SO my solution is to first remove the file extension of the file. That way either it gets automatically (not shown, but set correctly) or at a change it will be shown.

If you want the correct extension to be shown initially, just replace the file name's current extension by the one of the file type selected initially in your accessory view. In that case you should also see the extension changing when you select a different type from the menu.


I think maybe not totally straight, but that is how it is set up on the mac. Now I hope my code works on GNUstep.


I'm quite confident that it does work on GNUstep, too.

Wolfgang





reply via email to

[Prev in Thread] Current Thread [Next in Thread]