Games database: Load from the exe folder (only affects Install mode. Portable was already OK): Prevent DB-not-found error if previous version wasn't uninstalled properly.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4784 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
avihal@gmail.com 2011-06-30 20:54:30 +00:00
parent cdb54545fe
commit 79fb112c88
1 changed files with 16 additions and 1 deletions

View File

@ -16,6 +16,7 @@
#include "PrecompiledHeader.h"
#include "App.h"
#include "AppGameDatabase.h"
#include <wx/stdpaths.h>
class DBLoaderHelper
{
@ -153,7 +154,21 @@ AppGameDatabase& AppGameDatabase::LoadFromFile(const wxString& _file, const wxSt
{
wxString file(_file);
if( wxFileName(file).IsRelative() )
file = (InstallFolder + file).GetFullPath();
{
// InstallFolder is the preferred base directory for the DB file, but the registry can point to previous
// installs if uninstall wasn't done properly.
// Since the games DB file is considered part of pcsx2.exe itself, look for it at the exe folder
// regardless of any other settings.
// Note 1: Portable setup didn't suffer from this as install folder pointed already to the exe folder in portable.
// Note 2: Other folders are either configurable (plugins, memcards, etc) or create their content automatically (inis)
// So the games DB was really the only one that suffers from residues of prior installs.
//wxDirName dir = InstallFolder;
wxDirName dir = (wxDirName)wxFileName(wxStandardPaths::Get().GetExecutablePath()).GetPath();
file = ( dir + file ).GetFullPath();
}
if (!wxFileExists(file))
{