From 2c3a0a6af9f8fb08f9cf130166784e61c33d39a0 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 24 Jan 2020 14:51:02 +1000 Subject: [PATCH] HostInterface: Change working directory to user directory at startup --- src/core/host_interface.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/host_interface.cpp b/src/core/host_interface.cpp index 4cd34ae1e..b96d256b1 100644 --- a/src/core/host_interface.cpp +++ b/src/core/host_interface.cpp @@ -453,6 +453,13 @@ void HostInterface::SetUserDirectory() #endif Log_InfoPrintf("User directory: %s", m_user_directory.c_str()); + + // Change to the user directory so that all default/relative paths in the config are after this. + if (!m_user_directory.empty()) + { + if (!FileSystem::SetWorkingDirectory(m_user_directory.c_str())) + Log_ErrorPrintf("Failed to set working directory to '%s'", m_user_directory.c_str()); + } } std::string HostInterface::GetUserDirectoryRelativePath(const char* format, ...)