From dc4ef1163f8eef7baee735fa6264ff81e6a7bc20 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Mon, 30 May 2022 00:22:16 +1000 Subject: [PATCH] Qt: Add logging of early directory setup Makes debugging this stuff easier in the future. --- pcsx2-qt/QtHost.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pcsx2-qt/QtHost.cpp b/pcsx2-qt/QtHost.cpp index 3be4bd4117..3a94ce8f01 100644 --- a/pcsx2-qt/QtHost.cpp +++ b/pcsx2-qt/QtHost.cpp @@ -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(std::move(path)); Host::Internal::SetBaseSettingsLayer(s_base_settings_interface.get());