Avoid unnecessary cache validation

This commit is contained in:
Linus Dierheimer
2022-04-11 18:54:56 +02:00
parent 8831c07d2b
commit 430fe9fe9a
3 changed files with 7 additions and 2 deletions
+3
View File
@@ -35,6 +35,9 @@ static void writeCacheFile(FFinstance* instance, const char* moduleName, const c
void ffCacheValidate(FFinstance* instance)
{
if(instance->config.recache)
return;
FFstrbuf content;
ffStrbufInit(&content);
readCacheFile(instance, "cacheversion", "ffv", &content);
+3 -1
View File
@@ -222,7 +222,6 @@ void ffInitInstance(FFinstance* instance)
{
initState(&instance->state);
defaultConfig(instance);
ffCacheValidate(instance);
}
static void resetConsole(bool disableLinewrap, bool hideCursor)
@@ -256,6 +255,9 @@ void ffStart(FFinstance* instance)
sigaction(SIGTERM, &action, NULL);
sigaction(SIGQUIT, &action, NULL);
//We do the cache validation here, so we can skip it if --recache is given
ffCacheValidate(instance);
//reset everything to default before we start printing
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
+1 -1
View File
@@ -693,7 +693,7 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
else if(strcasecmp(key, "-r") == 0 || strcasecmp(key, "--recache") == 0)
{
//Set cacheSave as well, beacuse the user expects the values to be cached when expliciting using --recache
//Set cacheSave as well, because the user expects the values to be cached when expliciting using --recache
instance->config.recache = optionParseBoolean(value);
instance->config.cacheSave = instance->config.recache;
}