From 73f67a227253cbdb07de4ee77d0ccec4bd6c6e8b Mon Sep 17 00:00:00 2001 From: janwas Date: Sat, 20 Mar 2010 17:20:23 +0000 Subject: [PATCH] set crashlog location as soon as it is known to avoid writing to the default location (system/binaries), which might not be writable. fixes #403 This was SVN commit r7373. --- source/ps/GameSetup/GameSetup.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/ps/GameSetup/GameSetup.cpp b/source/ps/GameSetup/GameSetup.cpp index 9e331aecd1..9adb060ce8 100644 --- a/source/ps/GameSetup/GameSetup.cpp +++ b/source/ps/GameSetup/GameSetup.cpp @@ -504,7 +504,14 @@ static void InitVfs(const CmdLineArgs& args) fs::wpath logs(paths.Logs()); CreateDirectories(logs, 0700); + psSetLogDir(logs); + // desired location for crashlog is now known. update AppHooks ASAP + // (particularly before the following error-prone operations): + AppHooks hooks = {0}; + hooks.bundle_logs = psBundleLogs; + hooks.get_log_dir = psLogDir; + app_hooks_update(&hooks); const size_t cacheSize = ChooseCacheSize(); g_VFS = CreateVfs(cacheSize); @@ -845,8 +852,6 @@ void Init(const CmdLineArgs& args, int flags) AppHooks hooks = {0}; hooks.translate = psTranslate; hooks.translate_free = psTranslateFree; - hooks.bundle_logs = psBundleLogs; - hooks.get_log_dir = psLogDir; app_hooks_update(&hooks); // Set up the console early, so that debugging