diff options
Diffstat (limited to 'apps/open_plugin.c')
-rw-r--r-- | apps/open_plugin.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/apps/open_plugin.c b/apps/open_plugin.c index 46b6007ee2..1256db79f8 100644 --- a/apps/open_plugin.c +++ b/apps/open_plugin.c | |||
@@ -304,12 +304,8 @@ uint32_t open_plugin_add_path(const char *key, const char *plugin, const char *p | |||
304 | op_update_dat(op_entry, true); | 304 | op_update_dat(op_entry, true); |
305 | } | 305 | } |
306 | 306 | ||
307 | if (plugin) | 307 | while (plugin) |
308 | { | 308 | { |
309 | op_entry->hash = hash; | ||
310 | op_entry->lang_id = lang_id; | ||
311 | op_entry->checksum = open_plugin_csum + | ||
312 | (lang_id <= OPEN_PLUGIN_LANG_INVALID ? 0 : LANG_LAST_INDEX_IN_ARRAY); | ||
313 | /* name */ | 309 | /* name */ |
314 | if (path_basename(plugin, (const char **)&pos) == 0) | 310 | if (path_basename(plugin, (const char **)&pos) == 0) |
315 | pos = "\0"; | 311 | pos = "\0"; |
@@ -323,28 +319,33 @@ uint32_t open_plugin_add_path(const char *key, const char *plugin, const char *p | |||
323 | if(!parameter) | 319 | if(!parameter) |
324 | parameter = ""; | 320 | parameter = ""; |
325 | strmemccpy(op_entry->param, parameter, OPEN_PLUGIN_BUFSZ); | 321 | strmemccpy(op_entry->param, parameter, OPEN_PLUGIN_BUFSZ); |
326 | goto retnhash; | ||
327 | } | 322 | } |
328 | else if (len > OP_LEN && strcasecmp(&(pos[len-OP_LEN]), "." OP_EXT) == 0) | 323 | else if (len > OP_LEN && strcasecmp(&(pos[len-OP_LEN]), "." OP_EXT) == 0) |
329 | { | 324 | { |
325 | /* get the entry from the opx file */ | ||
330 | op_load_entry(0, OPEN_PLUGIN_LANG_IGNORE, op_entry, plugin); | 326 | op_load_entry(0, OPEN_PLUGIN_LANG_IGNORE, op_entry, plugin); |
331 | goto retnhash; | ||
332 | } | 327 | } |
328 | else | ||
329 | { | ||
330 | break; | ||
331 | } | ||
332 | op_entry->hash = hash; | ||
333 | op_entry->lang_id = lang_id; | ||
334 | op_entry->checksum = open_plugin_csum + | ||
335 | (lang_id <= OPEN_PLUGIN_LANG_INVALID ? 0 : LANG_LAST_INDEX_IN_ARRAY); | ||
336 | logf("OP add_path name: %s %s %s", | ||
337 | op_entry->name, op_entry->path, op_entry->param); | ||
338 | return hash; | ||
333 | } | 339 | } |
334 | 340 | ||
335 | logf("OP add_path Invalid, *Clearing entry*"); | 341 | logf("OP add_path Invalid, *Clearing entry*"); |
336 | if (lang_id != LANG_SHORTCUTS) /* from shortcuts menu */ | 342 | if (lang_id != LANG_SHORTCUTS) /* from shortcuts menu */ |
337 | splashf(HZ * 2, str(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos); | 343 | splashf(HZ * 2, str(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos); |
338 | op_clear_entry(op_entry); | 344 | op_clear_entry(op_entry); |
339 | hash = 0; | 345 | return 0; |
340 | |||
341 | retnhash: | ||
342 | logf("OP add_path name: %s %s %s", | ||
343 | op_entry->name, op_entry->path, op_entry->param); | ||
344 | return hash; | ||
345 | } | 346 | } |
346 | 347 | ||
347 | /* only displays directories and .rock files */ | 348 | /* only displays directories, .rock, and .opx files */ |
348 | static bool callback_show_item(char *name, int attr, struct tree_context *tc) | 349 | static bool callback_show_item(char *name, int attr, struct tree_context *tc) |
349 | { | 350 | { |
350 | (void)name; | 351 | (void)name; |
@@ -358,6 +359,10 @@ static bool callback_show_item(char *name, int attr, struct tree_context *tc) | |||
358 | { | 359 | { |
359 | return true; | 360 | return true; |
360 | } | 361 | } |
362 | else if(attr & FILE_ATTR_OPX) | ||
363 | { | ||
364 | return true; | ||
365 | } | ||
361 | return false; | 366 | return false; |
362 | } | 367 | } |
363 | 368 | ||
@@ -375,7 +380,7 @@ void open_plugin_browse(const char *key) | |||
375 | struct open_plugin_entry_t *op_entry = open_plugin_get_entry(); | 380 | struct open_plugin_entry_t *op_entry = open_plugin_get_entry(); |
376 | 381 | ||
377 | logf("OP browse key: %s name: %s", | 382 | logf("OP browse key: %s name: %s", |
378 | (key ? P2STR((unsigned char *)key):"No Key"), open_plugin_entry.name); | 383 | (key ? P2STR((unsigned char *)key):"No Key"), op_entry->name); |
379 | logf("OP browse %s %s", op_entry->path, op_entry->param); | 384 | logf("OP browse %s %s", op_entry->path, op_entry->param); |
380 | 385 | ||
381 | if (op_entry->path[0] == '\0' || !file_exists(op_entry->path)) | 386 | if (op_entry->path[0] == '\0' || !file_exists(op_entry->path)) |
@@ -399,7 +404,7 @@ void open_plugin_browse(const char *key) | |||
399 | /* open_plugin_load_entry() | 404 | /* open_plugin_load_entry() |
400 | * recall of the plugin path and parameters based on supplied key | 405 | * recall of the plugin path and parameters based on supplied key |
401 | * returns the index in OPEN_PLUGIN_DAT where the entry was found (>= 0) | 406 | * returns the index in OPEN_PLUGIN_DAT where the entry was found (>= 0) |
402 | * if the entry was found but has not been saved returns OPEN_PLUGIN_NEEDS_FLUSHED | 407 | * if the entry was found but has not been saved returns OPEN_PLUGIN_NEEDS_FLUSHED |
403 | * otherwise returns OPEN_PLUGIN_NOT_FOUND (< 0) if key was not found | 408 | * otherwise returns OPEN_PLUGIN_NOT_FOUND (< 0) if key was not found |
404 | */ | 409 | */ |
405 | int open_plugin_load_entry(const char *key) | 410 | int open_plugin_load_entry(const char *key) |