mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-06 13:14:21 +01:00
CMake: add option CUSTOM_OS_RELEASE_PATH
And remove `--os-file`
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define FF_STR_INDIR(x) #x
|
||||
#define FF_STR(x) FF_STR_INDIR(x)
|
||||
|
||||
static inline bool allRelevantValuesSet(const FFOSResult* result)
|
||||
{
|
||||
return result->id.length > 0
|
||||
@@ -141,12 +144,11 @@ static void getDebianVersion(FFOSResult* result)
|
||||
|
||||
static void detectOS(FFOSResult* os)
|
||||
{
|
||||
if(instance.config.general.osFile.length > 0)
|
||||
{
|
||||
parseLsbRelease(instance.config.general.osFile.chars, os);
|
||||
parseOsRelease(instance.config.general.osFile.chars, os);
|
||||
return;
|
||||
}
|
||||
#ifdef FF_CUSTOM_OS_RELEASE_PATH
|
||||
parseOsRelease(FF_STR(FF_CUSTOM_OS_RELEASE_PATH), os);
|
||||
parseLsbRelease(FF_STR(FF_CUSTOM_OS_RELEASE_PATH), os);
|
||||
return;
|
||||
#endif
|
||||
|
||||
if(instance.config.general.escapeBedrock && parseOsRelease(FASTFETCH_TARGET_DIR_ROOT "/bedrock" FASTFETCH_TARGET_DIR_ETC "/bedrock-release", os))
|
||||
{
|
||||
|
||||
@@ -27,8 +27,6 @@ const char* ffOptionsParseGeneralJsonConfig(FFOptionsGeneral* options, yyjson_va
|
||||
options->escapeBedrock = yyjson_get_bool(val);
|
||||
else if (ffStrEqualsIgnCase(key, "playerName"))
|
||||
ffStrbufSetS(&options->playerName, yyjson_get_str(val));
|
||||
else if (ffStrEqualsIgnCase(key, "osFile"))
|
||||
ffStrbufSetS(&options->osFile, yyjson_get_str(val));
|
||||
else if (ffStrEqualsIgnCase(key, "dsForceDrm"))
|
||||
{
|
||||
if (yyjson_is_str(val))
|
||||
@@ -79,8 +77,6 @@ bool ffOptionsParseGeneralCommandLine(FFOptionsGeneral* options, const char* key
|
||||
options->escapeBedrock = ffOptionParseBoolean(value);
|
||||
else if(ffStrEqualsIgnCase(key, "--player-name"))
|
||||
ffOptionParseString(key, value, &options->playerName);
|
||||
else if (ffStrEqualsIgnCase(key, "--os-file"))
|
||||
ffOptionParseString(key, value, &options->osFile);
|
||||
else if(ffStrEqualsIgnCase(key, "--ds-force-drm"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
@@ -109,7 +105,6 @@ void ffOptionsInitGeneral(FFOptionsGeneral* options)
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
options->escapeBedrock = true;
|
||||
ffStrbufInit(&options->playerName);
|
||||
ffStrbufInit(&options->osFile);
|
||||
options->dsForceDrm = FF_DS_FORCE_DRM_TYPE_FALSE;
|
||||
#elif defined(_WIN32)
|
||||
options->wmiTimeout = 5000;
|
||||
@@ -120,7 +115,6 @@ void ffOptionsDestroyGeneral(FF_MAYBE_UNUSED FFOptionsGeneral* options)
|
||||
{
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
ffStrbufDestroy(&options->playerName);
|
||||
ffStrbufDestroy(&options->osFile);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -145,9 +139,6 @@ void ffOptionsGenerateGeneralJsonConfig(FFOptionsGeneral* options, yyjson_mut_do
|
||||
if (!ffStrbufEqual(&options->playerName, &defaultOptions.playerName))
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "playerName", &options->playerName);
|
||||
|
||||
if (!ffStrbufEqual(&options->osFile, &defaultOptions.osFile))
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "osFile", &options->osFile);
|
||||
|
||||
if (options->dsForceDrm != defaultOptions.dsForceDrm)
|
||||
{
|
||||
switch (options->dsForceDrm)
|
||||
|
||||
@@ -17,7 +17,6 @@ typedef struct FFOptionsGeneral
|
||||
// Module options that cannot be put in module option structure
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
FFstrbuf playerName;
|
||||
FFstrbuf osFile;
|
||||
bool escapeBedrock;
|
||||
FFDsForceDrmType dsForceDrm;
|
||||
#elif defined(_WIN32)
|
||||
|
||||
Reference in New Issue
Block a user