mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Fix fastfetch recaching every time if an old cache exists
This commit is contained in:
+2
-2
@@ -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
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user