mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 10:52:08 +02:00
OS (Linux): detect detailed debian version
Ref: https://github.com/dylanaraps/neofetch/issues/2381
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "os.h"
|
||||
#include "common/properties.h"
|
||||
#include "common/parsing.h"
|
||||
#include "common/io/io.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <string.h>
|
||||
@@ -121,6 +122,14 @@ static void getUbuntuFlavour(FFOSResult* result)
|
||||
}
|
||||
}
|
||||
|
||||
static void getDebianVersion(FFOSResult* result)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY debianVersion = ffStrbufCreate();
|
||||
ffAppendFileBuffer("/etc/debian_version", &debianVersion);
|
||||
if (debianVersion.length)
|
||||
ffStrbufSet(&result->version, &debianVersion);
|
||||
}
|
||||
|
||||
static void detectOS(FFOSResult* os)
|
||||
{
|
||||
if(instance.config.osFile.length > 0)
|
||||
@@ -169,6 +178,8 @@ void ffDetectOSImpl(FFOSResult* os)
|
||||
|
||||
detectOS(os);
|
||||
|
||||
if(ffStrbufIgnCaseCompS(&os->id, "ubuntu") == 0)
|
||||
if(ffStrbufIgnCaseEqualS(&os->id, "ubuntu"))
|
||||
getUbuntuFlavour(os);
|
||||
else if(ffStrbufIgnCaseEqualS(&os->id, "debian"))
|
||||
getDebianVersion(os);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user