diff options
-rw-r--r-- | apps/open_plugin.c | 17 | ||||
-rw-r--r-- | apps/root_menu.c | 4 |
2 files changed, 12 insertions, 9 deletions
diff --git a/apps/open_plugin.c b/apps/open_plugin.c index 8453b3976d..7b5513a92b 100644 --- a/apps/open_plugin.c +++ b/apps/open_plugin.c @@ -49,7 +49,7 @@ static inline void op_clear_entry(struct open_plugin_entry_t *entry) } } -static int op_update_dat(struct open_plugin_entry_t *entry) +static int op_update_dat(struct open_plugin_entry_t *entry, bool clear) { int fd, fd1; uint32_t hash; @@ -79,7 +79,9 @@ static int op_update_dat(struct open_plugin_entry_t *entry) rename(OPEN_PLUGIN_DAT ".tmp", OPEN_PLUGIN_DAT); - op_clear_entry(&open_plugin_entry); + if (clear) + op_clear_entry(&open_plugin_entry); + return 0; } @@ -106,7 +108,7 @@ uint32_t open_plugin_add_path(const char *key, const char *plugin, const char *p if(open_plugin_entry.hash != hash) { /* the entry in ram needs saved */ - op_update_dat(&open_plugin_entry); + op_update_dat(&open_plugin_entry, true); } if (plugin) @@ -182,9 +184,9 @@ static int open_plugin_hash_get_entry(uint32_t hash, if (hash != 0) { if(entry->hash == hash) /* hasn't been flushed yet? */ - return 0; + return -2; else - op_update_dat(&open_plugin_entry); + op_update_dat(&open_plugin_entry, true); } int fd = open(dat_file, O_RDONLY); @@ -232,7 +234,8 @@ int open_plugin_run(const char *key) const char *path; const char *param; - open_plugin_get_entry(key, &open_plugin_entry); + if (open_plugin_get_entry(key, &open_plugin_entry) == -2) /* entry needs flushed */ + op_update_dat(&open_plugin_entry, false); path = open_plugin_entry.path; param = open_plugin_entry.param; @@ -250,7 +253,7 @@ int open_plugin_run(const char *key) void open_plugin_cache_flush(void) { - op_update_dat(&open_plugin_entry); + op_update_dat(&open_plugin_entry, true); } #endif /* ndef __PCTOOL__ */ diff --git a/apps/root_menu.c b/apps/root_menu.c index 62014b619d..2eab43f504 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -848,7 +848,7 @@ void root_menu(void) } } - open_plugin_get_entry(key, &open_plugin_entry); + bool flush = (open_plugin_get_entry(key, &open_plugin_entry) == -2); char *path = open_plugin_entry.path; char *param = open_plugin_entry.param; if (param[0] == '\0') @@ -856,7 +856,7 @@ void root_menu(void) next_screen = load_plugin_screen(path, param); - if (next_screen != GO_TO_PLUGIN) + if (!flush && next_screen != GO_TO_PLUGIN) open_plugin_add_path(NULL, NULL, NULL); /* shortcuts may take several trips through the GO_TO_PLUGIN case |