summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-03-07 08:22:01 -0500
committerWilliam Wilgus <wilgus.william@gmail.com>2021-03-07 08:22:01 -0500
commit0dce97372987a0b25446c33c7bfd616780d9d7c0 (patch)
tree6bdfc7a0d52f6822080d94fba2095b12cf7a5d46 /apps/plugins
parent207514fb2578cfac611b4ab98b251d1524a55efe (diff)
downloadrockbox-0dce97372987a0b25446c33c7bfd616780d9d7c0.tar.gz
rockbox-0dce97372987a0b25446c33c7bfd616780d9d7c0.zip
OpenPlugins Allow opx shortcuts
Allow opx shortcuts to be run through the shortcut menu Change-Id: I6597b9485dfb224766c442257c4d9c8ac02eece4
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/open_plugins.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/apps/plugins/open_plugins.c b/apps/plugins/open_plugins.c
index 0e636a7097..f9133f91bb 100644
--- a/apps/plugins/open_plugins.c
+++ b/apps/plugins/open_plugins.c
@@ -36,7 +36,10 @@
36#include "../open_plugin.h" 36#include "../open_plugin.h"
37 37
38#define ROCK_EXT "rock" 38#define ROCK_EXT "rock"
39#define ROCK_LEN 5
40
39#define OP_EXT "opx" 41#define OP_EXT "opx"
42#define OP_LEN 4
40 43
41#define OP_PLUGIN_RESTART (PLUGIN_GOTO_PLUGIN | 0x8000) 44#define OP_PLUGIN_RESTART (PLUGIN_GOTO_PLUGIN | 0x8000)
42 45
@@ -106,7 +109,7 @@ static int op_entry_read_opx(const char *path)
106 int len; 109 int len;
107 110
108 len = rb->strlen(path); 111 len = rb->strlen(path);
109 if(len > 4 && rb->strcasecmp(&((path)[len-4]), "." OP_EXT) == 0) 112 if(len > OP_LEN && rb->strcasecmp(&((path)[len-OP_LEN]), "." OP_EXT) == 0)
110 { 113 {
111 fd_opx = rb->open(path, O_RDONLY); 114 fd_opx = rb->open(path, O_RDONLY);
112 if (fd_opx) 115 if (fd_opx)
@@ -136,8 +139,8 @@ static void op_entry_export(int selection)
136 if( !rb->kbd_input( filename, MAX_PATH, NULL ) ) 139 if( !rb->kbd_input( filename, MAX_PATH, NULL ) )
137 { 140 {
138 len = rb->strlen(filename); 141 len = rb->strlen(filename);
139 if(len > 4 && filename[len] != PATH_SEPCH && 142 if(len > OP_LEN && filename[len] != PATH_SEPCH &&
140 rb->strcasecmp(&((filename)[len-4]), "." OP_EXT) != 0) 143 rb->strcasecmp(&((filename)[len-OP_LEN]), "." OP_EXT) != 0)
141 { 144 {
142 rb->strcat(filename, "." OP_EXT); 145 rb->strcat(filename, "." OP_EXT);
143 } 146 }
@@ -291,7 +294,7 @@ static int op_entry_transfer(int fd, int fd_tmp,
291 294
292static uint32_t op_entry_add_path(const char *key, const char *plugin, const char *parameter, bool use_key) 295static uint32_t op_entry_add_path(const char *key, const char *plugin, const char *parameter, bool use_key)
293{ 296{
294 int len, extlen; 297 int len;
295 uint32_t hash; 298 uint32_t hash;
296 char *pos = "";; 299 char *pos = "";;
297 int fd_tmp = -1; 300 int fd_tmp = -1;
@@ -326,8 +329,7 @@ static uint32_t op_entry_add_path(const char *key, const char *plugin, const cha
326 rb->strlcpy(op_entry.name, pos, OPEN_PLUGIN_NAMESZ); 329 rb->strlcpy(op_entry.name, pos, OPEN_PLUGIN_NAMESZ);
327 330
328 len = rb->strlen(pos); 331 len = rb->strlen(pos);
329 extlen = rb->strlen("." ROCK_EXT); 332 if(len > ROCK_LEN && rb->strcasecmp(&(pos[len-ROCK_LEN]), "." ROCK_EXT) == 0)
330 if(len > extlen && rb->strcasecmp(&(pos[len-extlen]), "." ROCK_EXT) == 0)
331 { 333 {
332 fd_tmp = rb->open(OPEN_PLUGIN_DAT ".tmp", O_WRONLY | O_CREAT | O_TRUNC, 0666); 334 fd_tmp = rb->open(OPEN_PLUGIN_DAT ".tmp", O_WRONLY | O_CREAT | O_TRUNC, 0666);
333 if (fd_tmp < 0) 335 if (fd_tmp < 0)
@@ -478,7 +480,7 @@ static int op_entry_run(void)
478 char* param; 480 char* param;
479 if (op_entry.hash != 0 && op_entry.path[0] != '\0') 481 if (op_entry.hash != 0 && op_entry.path[0] != '\0')
480 { 482 {
481 rb->splash(1, ID2P(LANG_OPEN_PLUGIN)); 483 //rb->splash(1, ID2P(LANG_OPEN_PLUGIN));
482 path = op_entry.path; 484 path = op_entry.path;
483 param = op_entry.param; 485 param = op_entry.param;
484 if (param[0] == '\0') 486 if (param[0] == '\0')