mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 16:01:54 +02:00
Use the '%f' token to insert the selected file on the params.
Other tokens available are '%F', '%u' and '%U'. It replaces the previous token '[selFile]'.
This commit is contained in:
parent
0fc6ac67f0
commit
e7e21b424b
@ -48,6 +48,8 @@
|
|||||||
using fastdelegate::MakeDelegate;
|
using fastdelegate::MakeDelegate;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
static const char *tokens[] = { "%f", "%F", "%u", "%U", };
|
||||||
|
|
||||||
#ifdef HAVE_LIBOPK
|
#ifdef HAVE_LIBOPK
|
||||||
LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
|
LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
|
||||||
const char* linkfile, bool opk)
|
const char* linkfile, bool opk)
|
||||||
@ -130,8 +132,25 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
|
|||||||
param = opk_read_param(pdata, "Exec");
|
param = opk_read_param(pdata, "Exec");
|
||||||
if (!param)
|
if (!param)
|
||||||
ERROR("Missing \"Exec\" parameter\n");
|
ERROR("Missing \"Exec\" parameter\n");
|
||||||
else
|
else {
|
||||||
exec = param;
|
string tmp = param;
|
||||||
|
pos = tmp.find(' ');
|
||||||
|
exec = tmp.substr(0, pos);
|
||||||
|
|
||||||
|
if (pos != tmp.npos) {
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
params = tmp.substr(pos + 1);
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof(tokens) / sizeof(tokens[0]); i++) {
|
||||||
|
if (params.find(tokens[i]) != params.npos) {
|
||||||
|
selectorbrowser = true;
|
||||||
|
selectordir = CARD_ROOT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_DINGUX
|
#ifdef PLATFORM_DINGUX
|
||||||
param = opk_read_param(pdata, "Terminal");
|
param = opk_read_param(pdata, "Terminal");
|
||||||
@ -482,30 +501,25 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//selectedFile
|
if (selectedFile != "") {
|
||||||
if (selectedFile!="") {
|
string path;
|
||||||
string selectedFileExtension;
|
|
||||||
string selectedFileName;
|
|
||||||
string dir;
|
|
||||||
string::size_type i = selectedFile.rfind(".");
|
|
||||||
if (i != string::npos) {
|
|
||||||
selectedFileExtension = selectedFile.substr(i,selectedFile.length());
|
|
||||||
selectedFileName = selectedFile.substr(0,i);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedDir=="")
|
if (selectedDir == "")
|
||||||
dir = getSelectorDir();
|
path = getSelectorDir();
|
||||||
else
|
else
|
||||||
dir = selectedDir;
|
path = selectedDir;
|
||||||
if (params=="") {
|
|
||||||
params = cmdclean(dir+selectedFile);
|
path = cmdclean(path + selectedFile);
|
||||||
|
|
||||||
|
if (params == "") {
|
||||||
|
params = path;
|
||||||
} else {
|
} else {
|
||||||
string origParams = params;
|
unsigned int i;
|
||||||
params = strreplace(params,"[selFullPath]",cmdclean(dir+selectedFile));
|
string::size_type pos;
|
||||||
params = strreplace(params,"[selPath]",cmdclean(dir));
|
|
||||||
params = strreplace(params,"[selFile]",cmdclean(selectedFileName));
|
for (i = 0; i < sizeof(tokens) / sizeof(tokens[0]); i++)
|
||||||
params = strreplace(params,"[selExt]",cmdclean(selectedFileExtension));
|
while((pos = params.find(tokens[i])) != params.npos)
|
||||||
if (params == origParams) params += " " + cmdclean(dir+selectedFile);
|
params.replace(pos, 2, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user