summaryrefslogtreecommitdiff
path: root/win/System.cpp
diff options
context:
space:
mode:
authorleo2002-12-22 20:47:38 +0000
committerleo2002-12-22 20:47:38 +0000
commitaa72a5ebcc423829f042539f27bede420a1c576c (patch)
treecda76d545287b1369239bd2e26ceb4710c6341ea /win/System.cpp
parent4b8980c8dec33f46e2c12628ad46e5a672e4f3e1 (diff)
Set the default dir for the file dialogs.
git-svn-id: http://svn.leocad.org/trunk@325 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win/System.cpp')
-rw-r--r--win/System.cpp20
1 files changed, 9 insertions, 11 deletions
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)
{