Skip to content

Commit

Permalink
Fix fastfetch recaching every time if an old cache exists
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusDierheimer committed Mar 23, 2022
1 parent be84549 commit f0b9800
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
8 changes: 4 additions & 4 deletions src/common/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -261,7 +262,6 @@ void ffCacheValidate(FFinstance* instance)
ffWriteFileContent(path.chars, &version);
ffStrbufDestroy(&version);

ffStrbufDestroy(&content);
ffStrbufDestroy(&path);
}

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit f0b9800

Please sign in to comment.