Qt: Add logging of early directory setup

Makes debugging this stuff easier in the future.
This commit is contained in:
Connor McLaughlin 2022-05-30 00:22:16 +10:00 committed by refractionpcsx2
parent 2928837b76
commit dc4ef1163f
1 changed files with 16 additions and 1 deletions

View File

@ -56,6 +56,7 @@ static constexpr u32 SETTINGS_SAVE_DELAY = 1000;
namespace QtHost {
static bool InitializeConfig();
static bool ShouldUsePortableMode();
static void SetAppRoot();
static void SetResourcesDirectory();
static void SetDataDirectory();
static void HookSignals();
@ -115,10 +116,15 @@ void QtHost::Shutdown()
bool QtHost::SetCriticalFolders()
{
EmuFolders::AppRoot = Path::Canonicalize(Path::GetDirectory(FileSystem::GetProgramPath()));
SetAppRoot();
SetResourcesDirectory();
SetDataDirectory();
// logging of directories in case something goes wrong super early
Console.WriteLn("AppRoot Directory: %s", EmuFolders::AppRoot.c_str());
Console.WriteLn("DataRoot Directory: %s", EmuFolders::DataRoot.c_str());
Console.WriteLn("Resources Directory: %s", EmuFolders::Resources.c_str());
// allow SetDataDirectory() to change settings directory (if we want to split config later on)
if (EmuFolders::Settings.empty())
EmuFolders::Settings = Path::Combine(EmuFolders::DataRoot, "inis");
@ -143,6 +149,14 @@ bool QtHost::ShouldUsePortableMode()
return FileSystem::FileExists(Path::Combine(EmuFolders::AppRoot, "portable.ini").c_str());
}
void QtHost::SetAppRoot()
{
std::string program_path(FileSystem::GetProgramPath());
Console.WriteLn("Program Path: %s", program_path.c_str());
EmuFolders::AppRoot = Path::Canonicalize(Path::GetDirectory(program_path));
}
void QtHost::SetResourcesDirectory()
{
#ifndef __APPLE__
@ -227,6 +241,7 @@ bool QtHost::InitializeConfig()
return false;
const std::string path(Path::Combine(EmuFolders::Settings, "PCSX2.ini"));
Console.WriteLn("Loading config from %s.", path.c_str());
s_base_settings_interface = std::make_unique<INISettingsInterface>(std::move(path));
Host::Internal::SetBaseSettingsLayer(s_base_settings_interface.get());