[commit] r1604 - in trunk: GME/Gme Install
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Wed Oct 12 12:45:19 CDT 2011
Author: ksmyth
Date: Wed Oct 12 12:45:19 2011
New Revision: 1604
Log:
Support passing .xme files on command-line
Modified:
trunk/GME/Gme/GMEApp.cpp
trunk/Install/GME.wxs
Modified: trunk/GME/Gme/GMEApp.cpp
==============================================================================
--- trunk/GME/Gme/GMEApp.cpp Wed Oct 12 12:45:07 2011 (r1603)
+++ trunk/GME/Gme/GMEApp.cpp Wed Oct 12 12:45:19 2011 (r1604)
@@ -422,7 +422,10 @@
if( cmdInfo.m_nShellCommand == CCommandLineInfo::FileOpen ) {
CString conn = cmdInfo.m_strFileName;
if(conn.Find(_T("=")) < 0) {
- conn.Insert(0,_T("MGA="));
+ if (conn.Right(4).CompareNoCase(_T(".xme")) == 0)
+ conn.Insert(0, _T("XML="));
+ else
+ conn.Insert(0,_T("MGA="));
}
OpenProject(conn);
@@ -1276,6 +1279,20 @@
MSGTRY
{
+ if (conn.Left(4) == _T("XML=")) {
+ CString fullPath = conn.Right(conn.GetLength() - 4);
+ TCHAR buffer[MAX_PATH];
+ TCHAR* filepart = NULL;
+ GetFullPathName(fullPath, MAX_PATH, buffer, &filepart);
+ if (filepart == NULL) {
+ COMTHROW(E_FILEOPEN);
+ }
+ CString filename = filepart;
+ CString title = filename.Left(filename.ReverseFind('.'));
+ Importxml(fullPath, filepart, title);
+ return;
+ }
+
CWaitCursor wait;
ASSERT( mgaProject == 0 );
@@ -1317,11 +1334,10 @@
return; // ensures no more exception handlers or explanatory messages (or QueryProjectInfo calls)
}
- if(S_OK != mgaProject->QueryProjectInfo(PutInBstr(conn), &version, &parn, &parv, &parg, &ro_mode)) {
- AfxMessageBox(_T("Cannot query project information. Possible cause: missing/corrupt project file or database"));
+ if (FAILED(hr = mgaProject->QueryProjectInfo(PutInBstr(conn), &version, &parn, &parv, &parg, &ro_mode))) {
COMTHROW(hr);
}
- while(hr) {
+ while (true) {
CString msg;
CComVariant guidpar;
CString newparname;
@@ -1705,38 +1721,22 @@
if( mgaProject != NULL )
CloseProject();
- if (conn.Left(4) == _T("XML=")) {
- MSGTRY {
- CString fullPath = conn.Right(conn.GetLength() - 4);
- TCHAR buffer[MAX_PATH];
- TCHAR* filepart = NULL;
- GetFullPathName(fullPath, MAX_PATH, buffer, &filepart);
- if (filepart == NULL) {
- COMTHROW(E_FILEOPEN);
- }
- CString filename = filepart;
- CString title = filename.Left(filename.ReverseFind('.'));
- Importxml(fullPath, filepart, title);
- } MSGCATCH(_T("Error opening XME file"),;)
- } else {
- if (conn.Left(4) == _T("MGX=")) {
- CString fullPath = conn.Right(conn.GetLength() - 4);
- TCHAR buffer[MAX_PATH];
- TCHAR* filepart = NULL;
- GetFullPathName(fullPath, MAX_PATH, buffer, &filepart);
- if (filepart == NULL) {
- DisplayError(_T("Error opening MGX file"), E_FILEOPEN);
- return;
- }
- // FIXME: KMS: yes, the quotes are necessary...
- conn = _T("MGX=\"");
- // FIXME: KMS: yes, a trailing slash makes it not work
- conn += fullPath.Left(fullPath.GetLength() - _tcslen(filepart) - 1);
- conn += _T("\"");
+ if (conn.Left(4) == _T("MGX=")) {
+ CString fullPath = conn.Right(conn.GetLength() - 4);
+ TCHAR buffer[MAX_PATH];
+ TCHAR* filepart = NULL;
+ GetFullPathName(fullPath, MAX_PATH, buffer, &filepart);
+ if (filepart == NULL) {
+ DisplayError(_T("Error opening MGX file"), E_FILEOPEN);
+ return;
}
- OpenProject(conn);
+ // FIXME: KMS: yes, the quotes are necessary...
+ conn = _T("MGX=\"");
+ // FIXME: KMS: yes, a trailing slash makes it not work
+ conn += fullPath.Left(fullPath.GetLength() - _tcslen(filepart) - 1);
+ conn += _T("\"");
}
-
+ OpenProject(conn);
}
Modified: trunk/Install/GME.wxs
==============================================================================
--- trunk/Install/GME.wxs Wed Oct 12 12:45:07 2011 (r1603)
+++ trunk/Install/GME.wxs Wed Oct 12 12:45:19 2011 (r1604)
@@ -283,13 +283,18 @@
<RegistryValue Type='string' Value='[INSTALLDIR]GME.exe'/>
<RegistryValue Name='Path' Type='string' Value='[INSTALLDIR]'/>
</RegistryKey>
-
- <ProgId Id='GME.mgafile' Description='GME project file'>
- <Extension Id='mga' ContentType='application/x-mga'>
- <Verb Id='open' Command='Open with GME' TargetFile='GME.exe' Argument='"%1"' />
- </Extension>
- </ProgId>
- <Environment Id="GME_ROOT" Action="set" System="yes" Name="GME_ROOT" Value="[INSTALLDIR]" />
+
+ <ProgId Id='GME.mgafile' Description='GME project file'>
+ <Extension Id='mga' ContentType='application/x-mga'>
+ <Verb Id='open' Command='Open with GME' TargetFile='GME.exe' Argument='"%1"' />
+ </Extension>
+ </ProgId>
+ <ProgId Id='GME.xmefile' Description='GME XML project file'>
+ <Extension Id='xme' ContentType='application/x-xme'>
+ <Verb Id='open' Command='Open with GME' TargetFile='GME.exe' Argument='"%1"' />
+ </Extension>
+ </ProgId>
+ <Environment Id="GME_ROOT" Action="set" System="yes" Name="GME_ROOT" Value="[INSTALLDIR]" />
<RemoveFolder Id='RemoveShortcutFolder' On='uninstall' Directory='ShortcutFolder'/>
<!-- This is a bit awkward but might helps the user. We clear the (current) user registry from previous entries.
Not compliant with ICE checks (user registry access from systemwide component). -->
More information about the gme-commit
mailing list