set default install dir to whatever install dir was used last
prune old non-present installations by checking each for a Programs directory
This commit is contained in:
@@ -259,6 +259,14 @@ void CSMPackageInstallDlg::OnOK()
|
||||
CString sInstallDir;
|
||||
m_comboDir.GetWindowText( sInstallDir );
|
||||
|
||||
int iSelectedInstallDirIndex = m_comboDir.GetCurSel();
|
||||
if( iSelectedInstallDirIndex == -1 )
|
||||
{
|
||||
MessageBox( "No Installations", "Error", MB_OK|MB_ICONEXCLAMATION );
|
||||
return;
|
||||
}
|
||||
|
||||
SetDefaultInstallDir( iSelectedInstallDirIndex );
|
||||
|
||||
// Show comment (if any)
|
||||
CString sComment = m_zip.GetGlobalComment();
|
||||
|
||||
@@ -42,6 +42,10 @@ void GetStepManiaInstallDirs( CStringArray& asInstallDirsOut )
|
||||
if( sPath == "" ) // read failed
|
||||
continue; // skip
|
||||
|
||||
CString sProgramDir = sPath+"\\Program";
|
||||
if( !DoesFileExist(sProgramDir) )
|
||||
continue; // skip
|
||||
|
||||
asInstallDirsOut.push_back( sPath );
|
||||
}
|
||||
|
||||
@@ -70,6 +74,17 @@ void AddStepManiaInstallDir( CString sNewInstallDir )
|
||||
WriteStepManiaInstallDirs( asInstallDirs );
|
||||
}
|
||||
|
||||
void SetDefaultInstallDir( int iInstallDirIndex )
|
||||
{
|
||||
// move the specified index to the top of the list
|
||||
CStringArray asInstallDirs;
|
||||
GetStepManiaInstallDirs( asInstallDirs );
|
||||
ASSERT( iInstallDirIndex > 0 && iInstallDirIndex < asInstallDirs.size() );
|
||||
CString sDefaultInstallDir = asInstallDirs[iInstallDirIndex];
|
||||
asInstallDirs.erase( asInstallDirs.begin()+iInstallDirIndex );
|
||||
asInstallDirs.insert( asInstallDirs.begin(), sDefaultInstallDir );
|
||||
WriteStepManiaInstallDirs( asInstallDirs );
|
||||
}
|
||||
|
||||
bool GetPref( CString name, bool &val )
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
void WriteStepManiaInstallDirs( const CStringArray& asInstallDirsToWrite );
|
||||
void GetStepManiaInstallDirs( CStringArray& asInstallDirsOut );
|
||||
void AddStepManiaInstallDir( CString sNewInstallDir );
|
||||
void SetDefaultInstallDir( int iInstallDirIndex );
|
||||
|
||||
bool GetPref( CString name, bool &val );
|
||||
bool SetPref( CString name, bool val );
|
||||
|
||||
Reference in New Issue
Block a user