Windows Forms open and save default directories
I'm editing someone else's code that uses Windows Forms:
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.InitialDirectory = LevelEditorConstants.PATH_TO_DATA_DIR;
Somehow, the directory that opens is totally different than the constant value that is assigned to it. How else can this value be set? A text search for a string that is part of the path that does open turns up nothing in my entire solution.
UPDATE: After attempting to save a file in the correct location (navigating there manually开发者_运维知识库), and having it throw an exception for unrelated reasons, the problem is solved. I have no idea why.
SaveFileDialog and OpenFileDialog always uses last saved/opened folder. Had the same issue, not sure where it remembers/stores it, might be in the registry (like last opened documents in MS Word).
If you try it on a new session/user, it works fine.
精彩评论