[commit] r1323 - trunk/GME/Gme
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Wed May 25 12:29:17 CDT 2011
Author: ksmyth
Date: Wed May 25 12:29:17 2011
New Revision: 1323
Log:
File>Save As should start in the same dir as the current mga
Modified:
trunk/GME/Gme/GMEApp.cpp
trunk/GME/Gme/GMEApp.h
trunk/GME/Gme/MgaOpenDlg.cpp
Modified: trunk/GME/Gme/GMEApp.cpp
==============================================================================
--- trunk/GME/Gme/GMEApp.cpp Wed May 25 12:25:46 2011 (r1322)
+++ trunk/GME/Gme/GMEApp.cpp Wed May 25 12:29:17 2011 (r1323)
@@ -1943,21 +1943,10 @@
CString initialFile;
CString initialDir;
if (theApp.isMgaProj()) {
- CString conn = theApp.connString();
- const TCHAR* zsConn = conn;
- zsConn += 4; // skip MGA=
- TCHAR currentMgaPath[MAX_PATH];
- TCHAR* filename;
- if (!GetFullPathName(zsConn, MAX_PATH, currentMgaPath, &filename) || filename == 0) {
- } else {
- initialFile = filename;
- if (initialFile.Right(3) == _T("mga")) {
- initialFile.Truncate(initialFile.GetLength() - 3);
- initialFile += _T("xme");
- }
- filename--;
- *filename = '\0';
- initialDir = currentMgaPath;
+ getMgaPaths(initialFile, initialDir);
+ if (initialFile.Right(3) == _T("mga")) {
+ initialFile.Truncate(initialFile.GetLength() - 3);
+ initialFile += _T("xme");
}
}
@@ -3058,7 +3047,6 @@
bool CGMEApp::SetWorkingDirectory( LPCTSTR pPath)
{
- m_preferredPath = pPath;
return SetCurrentDirectory( pPath) == TRUE;
//int sc = _chdir( pPath);
//return sc == 0;
Modified: trunk/GME/Gme/GMEApp.h
==============================================================================
--- trunk/GME/Gme/GMEApp.h Wed May 25 12:25:46 2011 (r1322)
+++ trunk/GME/Gme/GMEApp.h Wed May 25 12:29:17 2011 (r1323)
@@ -71,6 +71,23 @@
inline bool isMgaProj() const { return proj_type_is_mga; }
inline CString connString() const { return currentConnection; }
+ void getMgaPaths(CString& filename, CString& dirname) {
+ ASSERT(isMgaProj);
+ ASSERT(mgaProject);
+ CString conn = connString();
+ const TCHAR* zsConn = conn;
+ zsConn += 4; // skip MGA=
+ TCHAR currentMgaPath[MAX_PATH];
+ TCHAR* tcfilename;
+ if (!GetFullPathName(zsConn, MAX_PATH, currentMgaPath, &tcfilename) || tcfilename == 0) {
+ } else {
+ filename = tcfilename;
+ *(tcfilename-1) = '\0';
+ dirname = currentMgaPath;
+ }
+ }
+
+
private:
virtual int Run();
void EmergencySave();
@@ -128,8 +145,6 @@
static const TCHAR * m_no_model_open_string;
- // directory preferred by the user
- CString m_preferredPath;
// called from CGMEOLEAPP:
bool SetWorkingDirectory( LPCTSTR pPath);
Modified: trunk/GME/Gme/MgaOpenDlg.cpp
==============================================================================
--- trunk/GME/Gme/MgaOpenDlg.cpp Wed May 25 12:25:46 2011 (r1322)
+++ trunk/GME/Gme/MgaOpenDlg.cpp Wed May 25 12:29:17 2011 (r1323)
@@ -127,13 +127,12 @@
OFN_EXPLORER | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT |
0, filters);
- // if preferred path was set by the user then change to that directory
- if( !theApp.m_preferredPath.IsEmpty())
+ CString file, dir;
+ if (theApp.isMgaProj() && theApp.mgaProject)
{
- OPENFILENAME &ofn = dlg.GetOFN();
- // better be successful in order to use in ofn structure
- if( theApp.SetWorkingDirectory( theApp.m_preferredPath))
- ofn.lpstrInitialDir = theApp.m_preferredPath;
+ theApp.getMgaPaths(file, dir);
+ if (dir != L"")
+ dlg.GetOFN().lpstrInitialDir = dir;
}
if( dlg.DoModal() == IDOK ) {
More information about the gme-commit
mailing list