mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
Better ffParseSemver
This commit is contained in:
@@ -371,21 +371,22 @@ bool ffGetPropValueFromLines(const char* lines, const char* start, FFstrbuf* buf
|
||||
|
||||
void ffParseSemver(FFstrbuf* buffer, const FFstrbuf* major, const FFstrbuf* minor, const FFstrbuf* patch)
|
||||
{
|
||||
if(major->length == 0 && minor->length == 0 && patch->length == 0)
|
||||
return;
|
||||
|
||||
if(major->length > 0)
|
||||
ffStrbufAppend(buffer, major);
|
||||
else
|
||||
else if(minor->length > 0 || patch->length > 0)
|
||||
ffStrbufAppendC(buffer, '1');
|
||||
|
||||
if(minor->length == 0 && patch->length == 0)
|
||||
return;
|
||||
|
||||
ffStrbufAppendC(buffer, '.');
|
||||
|
||||
if(minor->length > 0)
|
||||
ffStrbufAppend(buffer, minor);
|
||||
else if(patch->length > 0)
|
||||
ffStrbufAppendC(buffer, '0');
|
||||
else
|
||||
|
||||
if(patch->length == 0)
|
||||
return;
|
||||
|
||||
ffStrbufAppendC(buffer, '.');
|
||||
|
||||
Reference in New Issue
Block a user