Beware File Open/Save Dialogs: They May Change The Current Directory
On some Windows operating systems (primarily Windows 95, 98, and ME), GetOpenFileName()
and GetSaveFileName()
(and wrappers of these functions such as MFC’s CFileDialog
) will permanently change the process’s current working directory unless the OFN_NOCHANGEDIR
option is specified. As you can imagine, this can easily break your application if you ever rely on the current working directory being set to a particular value (such as if you open files using relative paths).
Of course, it is best to eliminate any such current working directory assumptions from your application completely.