COPKGManager: add variable to hold last selected source dir

This commit is contained in:
2014-11-25 10:46:59 +01:00
parent f4bc1c8cb7
commit 7b178e71f9
2 changed files with 10 additions and 7 deletions

View File

@@ -90,6 +90,7 @@ COPKGManager::COPKGManager()
list_installed_done = false; list_installed_done = false;
list_upgradeable_done = false; list_upgradeable_done = false;
expert_mode = false; expert_mode = false;
local_dir = g_settings.update_dir.c_str();
CFileHelpers::createDir("/tmp/.opkg"); CFileHelpers::createDir("/tmp/.opkg");
} }
@@ -144,14 +145,15 @@ int COPKGManager::exec(CMenuTarget* parent, const string &actionKey)
CFileBrowser fileBrowser; CFileBrowser fileBrowser;
fileBrowser.Filter = &fileFilter; fileBrowser.Filter = &fileFilter;
if (fileBrowser.exec(g_settings.update_dir.c_str())) if (fileBrowser.exec(local_dir.c_str()))
{ {
string pgk_name = fileBrowser.getSelectedFile()->Name; string pgk_name = fileBrowser.getSelectedFile()->Name;
int r = execCmd(pkg_types[OM_INSTALL] + pgk_name, true, true); int r = execCmd(pkg_types[OM_INSTALL] + pgk_name, true, true);
if (r) { local_dir = fileBrowser.getCurrentDir();
showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pgk_name); if (r) {
} else showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pgk_name);
installed = true; } else
installed = true;
refreshMenu(); refreshMenu();
} }
return res; return res;

View File

@@ -57,6 +57,7 @@ class COPKGManager : public CMenuTarget
bool installed; bool installed;
bool expert_mode; bool expert_mode;
int menu_offset; int menu_offset;
std::string local_dir;
int execCmd(const char* cmdstr, bool verbose = false, bool acknowledge = false); int execCmd(const char* cmdstr, bool verbose = false, bool acknowledge = false);
int execCmd(std::string cmdstr, bool verbose = false, bool acknowledge = false) { int execCmd(std::string cmdstr, bool verbose = false, bool acknowledge = false) {