From 5ba2d00504a70bb3dd4ba7bd196d0ee851cc53d3 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Tue, 20 Dec 2016 01:49:12 -0800 Subject: [PATCH] 3DS, PSP2, Wii: Last directory loaded is saved --- CHANGES | 1 + src/feature/gui/gui-runner.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGES b/CHANGES index 37e3a24ae..a4dc6796d 100644 --- a/CHANGES +++ b/CHANGES @@ -54,6 +54,7 @@ Misc: - GBA Memory: Support reading/writing POSTFLG - Util: Add size counting to Table - Qt: Move last directory setting from qt.ini to config.ini + - 3DS, PSP2, Wii: Last directory loaded is saved 0.5.1: (2016-10-05) Bugfixes: diff --git a/src/feature/gui/gui-runner.c b/src/feature/gui/gui-runner.c index eadb6955e..2a0ee06a7 100644 --- a/src/feature/gui/gui-runner.c +++ b/src/feature/gui/gui-runner.c @@ -171,6 +171,12 @@ void mGUIInit(struct mGUIRunner* runner, const char* port) { strncat(path, PATH_SEP "log", PATH_MAX - strlen(path)); logger.vf = VFileOpen(path, O_CREAT | O_WRONLY | O_APPEND); mLogSetDefaultLogger(&logger.d); + + const char* lastPath = mCoreConfigGetValue(&runner->config, "lastDirectory"); + if (lastPath) { + strncpy(runner->params.currentPath, lastPath, PATH_MAX - 1); + runner->params.currentPath[PATH_MAX - 1] = '\0'; + } } void mGUIDeinit(struct mGUIRunner* runner) { @@ -499,6 +505,8 @@ void mGUIRunloop(struct mGUIRunner* runner) { if (!GUISelectFile(&runner->params, path, sizeof(path), 0)) { break; } + mCoreConfigSetValue(&runner->config, "lastDirectory", runner->params.currentPath); + mCoreConfigSave(&runner->config); mGUIRun(runner, path); } }