1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-17 22:25:55 +02:00

Re-insert proper detection of the %f tokens for OPK apps

This commit is contained in:
Paul Cercueil 2014-04-18 09:10:01 +02:00
parent 47b098cce6
commit 92a6453ff8

View File

@ -56,6 +56,8 @@ using namespace std;
static const char *tokens[] = { "%f", "%F", "%u", "%U", }; static const char *tokens[] = { "%f", "%F", "%u", "%U", };
#define ARRAY_SIZE(x) (!sizeof(x) ?: sizeof(x) / sizeof((x)[0]))
#ifdef HAVE_LIBOPK #ifdef HAVE_LIBOPK
LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile, LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile,
struct OPK *opk, const char *metadata_) struct OPK *opk, const char *metadata_)
@ -141,6 +143,17 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile)
iconPath = this->icon; iconPath = this->icon;
updateSurfaces(); 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; continue;
} }
@ -623,7 +636,6 @@ void LinkApp::launch(const string &selectedFile) {
#endif #endif
} else { } else {
std::string command = exec + " " + params; 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); execlp("/bin/sh", "/bin/sh", "-c", command.c_str(), NULL);
} }