From aa72a5ebcc423829f042539f27bede420a1c576c Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 22 Dec 2002 20:47:38 +0000 Subject: Set the default dir for the file dialogs. git-svn-id: http://svn.leocad.org/trunk@325 c7d43263-9d01-0410-8a33-9dba5d9f93d6 --- win/System.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'win/System.cpp') diff --git a/win/System.cpp b/win/System.cpp index d1c8777..0f8596b 100644 --- a/win/System.cpp +++ b/win/System.cpp @@ -1066,10 +1066,6 @@ bool SystemDoDialog(int nMode, void* param) { case LC_DLG_FILE_OPEN_PROJECT: { - char *defdir = (char*)param; - if (strlen(defdir)) - _chdir(defdir); - CFileDialog dlg(TRUE, "*.lcd", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "LeoCAD Projects (*.lcd)|*.lcd|LDraw Files (*.dat)|*.dat|All Files (*.*)|*.*||", AfxGetMainWnd()); dlg.m_ofn.Flags |= (OFN_ENABLETEMPLATE|OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_ENABLEHOOK|OFN_EXPLORER); @@ -1077,6 +1073,10 @@ bool SystemDoDialog(int nMode, void* param) dlg.m_ofn.lpfnHook = OFNOpenHookProc; dlg.m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_OPENDLG_TEMPLATE); + char *defdir = (char*)param; + if (strlen(defdir)) + dlg.m_ofn.lpstrInitialDir = defdir; + if (dlg.DoModal() == IDOK) { char szFullPath[LC_MAXPATH]; @@ -1106,10 +1106,6 @@ bool SystemDoDialog(int nMode, void* param) case LC_DLG_FILE_MERGE_PROJECT: { - char *defdir = (char*)param; - if (strlen(defdir)) - _chdir(defdir); - CFileDialog dlg(TRUE, "*.lcd", NULL, OFN_HIDEREADONLY|OFN_ENABLETEMPLATE|OFN_FILEMUSTEXIST|OFN_ENABLEHOOK|OFN_EXPLORER, "LeoCAD Projects (*.lcd)|*.lcd|All Files (*.*)|*.*||", AfxGetMainWnd()); @@ -1118,6 +1114,10 @@ bool SystemDoDialog(int nMode, void* param) dlg.m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_OPENDLG_TEMPLATE); dlg.m_ofn.lpstrTitle = "Merge"; + char *defdir = (char*)param; + if (strlen(defdir)) + dlg.m_ofn.lpstrInitialDir = defdir; + if (dlg.DoModal() == IDOK) { strcpy((char*)param, dlg.GetPathName()); @@ -1129,9 +1129,6 @@ bool SystemDoDialog(int nMode, void* param) { LC_FILEOPENDLG_OPTS* opts = (LC_FILEOPENDLG_OPTS*)param; - if (strlen(opts->path)) - _chdir(opts->path); - if (opts->type == LC_FILEOPENDLG_DAT) { CString filename; @@ -1140,6 +1137,7 @@ bool SystemDoDialog(int nMode, void* param) "LDraw Files (*.dat)|*.dat|All Files (*.*)|*.*||",NULL); dlg.m_ofn.lpstrFile = filename.GetBuffer(_MAX_PATH * 32); dlg.m_ofn.nMaxFile = _MAX_PATH; + dlg.m_ofn.lpstrInitialDir = opts->path; if (dlg.DoModal() == IDOK) { -- cgit v1.2.3