summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c55
1 files changed, 32 insertions, 23 deletions
diff --git a/apps/tree.c b/apps/tree.c
index f72774fe1e..938e44d350 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -52,7 +52,7 @@
52#include "talk.h" 52#include "talk.h"
53#include "filetypes.h" 53#include "filetypes.h"
54#include "misc.h" 54#include "misc.h"
55#include "filefuncs.h" 55#include "pathfuncs.h"
56#include "filetree.h" 56#include "filetree.h"
57#include "tagtree.h" 57#include "tagtree.h"
58#ifdef HAVE_RECORDING 58#ifdef HAVE_RECORDING
@@ -1205,26 +1205,36 @@ void tree_flush(void)
1205#endif 1205#endif
1206 1206
1207#ifdef HAVE_DIRCACHE 1207#ifdef HAVE_DIRCACHE
1208 int old_val = global_status.dircache_size;
1209#ifdef HAVE_EEPROM_SETTINGS
1210 bool savecache = false;
1211#endif
1212
1213 if (global_settings.dircache)
1208 { 1214 {
1209 int old_val = global_status.dircache_size; 1215 dircache_suspend();
1210 if (global_settings.dircache) 1216
1211 { 1217 struct dircache_info info;
1212 if (!dircache_is_initializing()) 1218 dircache_get_info(&info);
1213 global_status.dircache_size = dircache_get_cache_size(); 1219
1214# ifdef HAVE_EEPROM_SETTINGS 1220 global_status.dircache_size = info.last_size;
1215 if (firmware_settings.initialized) 1221 #ifdef HAVE_EEPROM_SETTINGS
1216 dircache_save(); 1222 savecache = firmware_settings.initialized;
1217# endif 1223 #endif
1218 dircache_suspend();
1219 }
1220 else
1221 {
1222 global_status.dircache_size = 0;
1223 }
1224 if (old_val != global_status.dircache_size)
1225 status_save();
1226 } 1224 }
1227#endif 1225 else
1226 {
1227 global_status.dircache_size = 0;
1228 }
1229
1230 if (old_val != global_status.dircache_size)
1231 status_save();
1232
1233 #ifdef HAVE_EEPROM_SETTINGS
1234 if (savecache)
1235 dircache_save();
1236 #endif
1237#endif /* HAVE_DIRCACHE */
1228} 1238}
1229 1239
1230void tree_restore(void) 1240void tree_restore(void)
@@ -1238,15 +1248,14 @@ void tree_restore(void)
1238#endif 1248#endif
1239 1249
1240#ifdef HAVE_DIRCACHE 1250#ifdef HAVE_DIRCACHE
1241 remove(DIRCACHE_FILE); 1251 if (global_settings.dircache && dircache_resume() > 0)
1242 if (global_settings.dircache)
1243 { 1252 {
1244 /* Print "Scanning disk..." to the display. */ 1253 /* Print "Scanning disk..." to the display. */
1245 splash(0, str(LANG_SCANNING_DISK)); 1254 splash(0, str(LANG_SCANNING_DISK));
1246 1255 dircache_wait();
1247 dircache_build(global_status.dircache_size);
1248 } 1256 }
1249#endif 1257#endif
1258
1250#ifdef HAVE_TAGCACHE 1259#ifdef HAVE_TAGCACHE
1251 tagcache_start_scan(); 1260 tagcache_start_scan();
1252#endif 1261#endif