From 92a6453ff8e710dc096122f9ff23f6bf4e17d2a4 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Fri, 18 Apr 2014 09:10:01 +0200 Subject: [PATCH] Re-insert proper detection of the %f tokens for OPK apps --- src/linkapp.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/linkapp.cpp b/src/linkapp.cpp index 86fc210..6afee3c 100644 --- a/src/linkapp.cpp +++ b/src/linkapp.cpp @@ -56,6 +56,8 @@ using namespace std; static const char *tokens[] = { "%f", "%F", "%u", "%U", }; +#define ARRAY_SIZE(x) (!sizeof(x) ?: sizeof(x) / sizeof((x)[0])) + #ifdef HAVE_LIBOPK LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile, struct OPK *opk, const char *metadata_) @@ -141,6 +143,17 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile) iconPath = this->icon; updateSurfaces(); + } else if (!strncmp(key, "Exec", lkey)) { + string tmp = buf; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(tokens); i++) { + if (tmp.find(tokens[i]) != tmp.npos) { + selectordir = CARD_ROOT; + break; + } + } + continue; } @@ -623,7 +636,6 @@ void LinkApp::launch(const string &selectedFile) { #endif } else { std::string command = exec + " " + params; - INFO("Executing '%s' (%s)\n", title.c_str(), command.c_str()); execlp("/bin/sh", "/bin/sh", "-c", command.c_str(), NULL); }