Saving a file to / loading a file from a specific folder
Posted on 2012-09-18
This is probably a no brainer but I'm not sure of the best way of making it happen. I have a MIDI application, 4 different docment types. 4 of these are created by the user using a maintenance facility designed for each. These can also be loaded for additional file maintenance and are selected and loaded as input into another function of this application. When the application executes and completes 3 additional document types are created. These 3 created documents can subsequently be loaded into the application for analysis by yet a different set of functions.
The way this application currently exists, all documents are crated in, loaded from and saved back in the same folder containing the executable. That was fine for development but is crappy for a delivered application.
What I am looking for is a way to save the 3 application created documents in a specific folder, say a folder in the "My Documents" directory. I would also like to save the 4 user created / user maintained documents is a folder of their own, which can be in the "My Documents" directory or in a folder below the "Programs" directory where the application resides.
I need to be able to direct the "Open File Dialog" for all of these documents to automatically present the appropriate folder for the user to view wneh he/she decides to open one of these documents.
It may be as simple as changing the directory via
SetCurrentDirectory( lpPathName )
But I think that is dangerous if the application craps out before the directory can be reset back to its original setting, screwing up the user's environment.
Is my fear naive? Is this the correct approach? Is there a better way?
Thanks in advance.