Fix fastfetch recaching every time if an old cache exists

This commit is contained in:
Linus Dierheimer
2022-03-23 11:38:42 +01:00
parent be84549f4c
commit f0b9800974
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -1,13 +1,13 @@
cmake_minimum_required(VERSION 3.1.0) # Threads::Threads
project(fastfetch
VERSION 1.1.0
VERSION 1.1.1
LANGUAGES C
)
#e.g. +1
#This allows to track builds between versions, without GitHub creating a new release
set(PROJECT_VERSION_EXTRA "+1")
set(PROJECT_VERSION_EXTRA "")
include(GNUInstallDirs)
+4 -4
View File
@@ -246,9 +246,10 @@ void ffCacheValidate(FFinstance* instance)
ffStrbufInit(&content);
ffAppendFileContent(path.chars, &content);
if(ffStrbufCompS(&content, FASTFETCH_PROJECT_VERSION) == 0)
bool isSameVersion = ffStrbufCompS(&content, FASTFETCH_PROJECT_VERSION) == 0;
ffStrbufDestroy(&content);
if(isSameVersion)
{
ffStrbufDestroy(&content);
ffStrbufDestroy(&path);
return;
}
@@ -261,7 +262,6 @@ void ffCacheValidate(FFinstance* instance)
ffWriteFileContent(path.chars, &version);
ffStrbufDestroy(&version);
ffStrbufDestroy(&content);
ffStrbufDestroy(&path);
}
@@ -409,7 +409,7 @@ bool ffWriteFDContent(int fd, const FFstrbuf* content)
void ffWriteFileContent(const char* fileName, const FFstrbuf* content)
{
int fd = open(fileName, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
int fd = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if(fd == -1)
return;