setAsCurrentWorkingDirectory() question

I’m trying to set my FileChooser object to open in the same directory that it used the last time I opened a file,
using getCurrentWorkingDirectory() thus:

[code]FileChooser theFileChooser (“Please select file you want to open…”,

bool fileSelected = theFileChooser.browseForFileToOpen();

if (fileSelected){

	File	theFile (theFileChooser.getResult());


But this doesn’t seem to be working. I’m sure I’m just using this call incorrectly, but what’s the right way to do this?

It probably should work, but it’s a dreadful way to do it! Just store the last file in a File object somewhere, there’s no need to use the CWD as a place to store it!

That’s a fine suggestion. I was trying to solve the problem in such a way that the FileChooser would open in a useful location across runs of my application, and have the system hold onto that information, rather than me.

How did you expect that to work?? The CWD is held by the shell, it’s not a global setting! (And if it was a global, that’d make your idea even more insane!!)

OK, granted, that was a näive thing to postulate.

I was thinking that the OS was holding on to the last location used in an Open dialog,
but now I see it varies by application, and applications are holding on to that location
on their own. I’ll do the same.