Add new command line switch: "--configpath YOURPATHHERE"
This commit is contained in:
parent
3162c1554e
commit
08bd48b812
|
@ -10,7 +10,7 @@ static CString *regVbaPath = NULL;
|
|||
|
||||
bool regEnabled = true;
|
||||
|
||||
void regInit(const char *path)
|
||||
void regInit(const char *path, bool force)
|
||||
{
|
||||
if( regEnabled ) {
|
||||
DWORD disp = 0;
|
||||
|
@ -32,7 +32,7 @@ void regInit(const char *path)
|
|||
// If vba.ini exists in executable's folder, use it. Else create/use one in %appdata% folder.
|
||||
regVbaPath = new CString();
|
||||
regVbaPath->Format(MakeInstanceFilename("%s\\vba.ini"), path);
|
||||
if( !utilFileExists( regVbaPath->GetString() ) ) {
|
||||
if( !force && !utilFileExists( regVbaPath->GetString() ) ) {
|
||||
TCHAR appdata[MAX_PATH+1];
|
||||
SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdata );
|
||||
regVbaPath->Format( "%s\\VBA-M", appdata );
|
||||
|
|
|
@ -10,7 +10,7 @@ void regSetStringValue(const char *key,const char *value);
|
|||
void regSetDwordValue(const char *key,DWORD value,bool force=false);
|
||||
void regSetBinaryValue(const char *key, char *value, int count);
|
||||
void regDeleteValue(char *key);
|
||||
void regInit(const char *);
|
||||
void regInit(const char *, bool force = false);
|
||||
void regShutdown();
|
||||
bool regCreateFileType( const char *ext, const char *type );
|
||||
bool regAssociateType( const char *type, const char *desc, const char *application, const char *icon = NULL );
|
||||
|
|
|
@ -443,7 +443,32 @@ BOOL VBA::InitInstance()
|
|||
if(!InitLink())
|
||||
return FALSE;;
|
||||
|
||||
regInit(winBuffer);
|
||||
bool force = false;
|
||||
|
||||
if (m_lpCmdLine[0])
|
||||
{
|
||||
if(__argc > 0) {
|
||||
if( 0 == strcmp( __argv[1], "--configpath" ) ) {
|
||||
if( __argc > 2 ) {
|
||||
strcpy( winBuffer, __argv[2] );
|
||||
force = true;
|
||||
if( __argc > 3 ) {
|
||||
szFile = __argv[3]; filename = szFile;
|
||||
int index = filename.ReverseFind('.');
|
||||
if(index != -1)
|
||||
filename = filename.Left(index);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
szFile = __argv[1]; filename = szFile;
|
||||
int index = filename.ReverseFind('.');
|
||||
if(index != -1)
|
||||
filename = filename.Left(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
regInit(winBuffer, force);
|
||||
|
||||
loadSettings();
|
||||
|
||||
|
@ -480,22 +505,12 @@ BOOL VBA::InitInstance()
|
|||
|
||||
winAccelMgr.UpdateMenu(menu);
|
||||
|
||||
if (m_lpCmdLine[0])
|
||||
{
|
||||
if(__argc > 0) {
|
||||
szFile = __argv[1];
|
||||
filename = szFile;
|
||||
}
|
||||
int index = filename.ReverseFind('.');
|
||||
|
||||
if(index != -1)
|
||||
filename = filename.Left(index);
|
||||
|
||||
if(((MainWnd*)m_pMainWnd)->FileRun())
|
||||
emulating = true;
|
||||
else
|
||||
emulating = false;
|
||||
}
|
||||
if( !filename.IsEmpty() ) {
|
||||
if(((MainWnd*)m_pMainWnd)->FileRun())
|
||||
emulating = true;
|
||||
else
|
||||
emulating = false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue