@@ -41,6 +41,7 @@ CMainWindow::CMainWindow( QWidget* pParent )
4141 m_ErrorBoxWidget( this ->errorBox, this ->errorBoxMsg, this ->errorBoxBtn ),
4242 m_StatusWidget( this ->lblStatus, this ->pbStatus ),
4343 m_LastOpenDir( QDir::homePath() ), m_LastExtractDir( QDir::homePath() ),
44+ m_LastIndexDir( QDir::homePath() ),
4445 m_bShouldDecrypt( true ), m_bShouldDecompress( true )
4546{
4647 this ->SetLoadedFilename ();
@@ -96,6 +97,7 @@ void CMainWindow::OnIndexFileAccepted( GameDataInfo info )
9697
9798 // FIXME: index entry is loaded as a package
9899 // this->AddToRecentFiles( info.GetGameDataPath() );
100+ this ->m_LastIndexDir = QString::fromStdString ( info.GetGameDataPath ().generic_string () );
99101 this ->SetLoadedFilename ( info.GetGameDataPath ().generic_string () );
100102}
101103
@@ -537,6 +539,11 @@ void CMainWindow::ValidateLastDirs()
537539 {
538540 this ->m_LastExtractDir = QDir::homePath ();
539541 }
542+
543+ if ( fs::is_directory ( this ->m_LastIndexDir .toStdString () ) == false )
544+ {
545+ this ->m_LastIndexDir = {};
546+ }
540547}
541548
542549void CMainWindow::LoadSettings ()
@@ -571,6 +578,8 @@ void CMainWindow::LoadSettings()
571578 settings.value ( QStringLiteral ( " lastopendir" ) ).toString ();
572579 this ->m_LastExtractDir =
573580 settings.value ( QStringLiteral ( " lastextractdir" ) ).toString ();
581+ this ->m_LastIndexDir =
582+ settings.value ( QStringLiteral ( " lastindexdir" ) ).toString ();
574583 settings.endGroup ();
575584
576585 this ->PostLoadSettings ();
@@ -610,6 +619,8 @@ void CMainWindow::SaveSettings()
610619 settings.setValue ( QStringLiteral ( " lastopendir" ), this ->m_LastOpenDir );
611620 settings.setValue ( QStringLiteral ( " lastextractdir" ),
612621 this ->m_LastExtractDir );
622+ settings.setValue ( QStringLiteral ( " lastindexdir" ),
623+ this ->m_LastIndexDir );
613624 settings.endGroup ();
614625}
615626
@@ -690,7 +701,7 @@ void CMainWindow::OnFileOpen()
690701
691702void CMainWindow::OnIndexFileOpen ()
692703{
693- CLoadIndexDialog ( this ).exec ();
704+ CLoadIndexDialog ( this , this -> m_LastIndexDir ).exec ();
694705}
695706
696707void CMainWindow::OnRecentFileOpen ()
0 commit comments