From c94968f533bdead39a487105e3044c2ffacf17c6 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 23 Oct 2012 05:34:21 +0200 Subject: [PATCH] Memorize the selector's directory as the default one for later use When a app is launched with a file selected with the built-in file selector, we memorize the directory on which the file was found, so that a future launch of that application will directly open that directory. --- src/linkapp.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/linkapp.cpp b/src/linkapp.cpp index e6f30da..97597bb 100644 --- a/src/linkapp.cpp +++ b/src/linkapp.cpp @@ -313,6 +313,8 @@ bool LinkApp::targetExists() bool LinkApp::save() { if (!edited) return false; + DEBUG("Saving file: %s\n", file.c_str()); + ofstream f(file.c_str()); if (f.is_open()) { #ifdef HAVE_LIBOPK @@ -501,6 +503,11 @@ void LinkApp::selector(int startSelection, const string &selectorDir) { void LinkApp::launch(const string &selectedFile, const string &selectedDir) { drawRun(); + + if (selectedDir == "") + selectordir = getSelectorDir(); + else + selectordir = selectedDir; save(); #ifdef HAVE_LIBOPK @@ -535,13 +542,7 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) { #endif if (selectedFile != "") { - string path; - - if (selectedDir == "") - path = getSelectorDir(); - else - path = selectedDir; - path = cmdclean(path + selectedFile); + string path = cmdclean(selectordir + selectedFile); if (params == "") { params = path;