mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
Battery (Linux): remove option --battery-dir
It was added in c5c3cecb93 but there was no comment or issues linked to indicate why it was necessary.
`/sys/class/power_supply` is standardized in <https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power>. I don't I want to support non-standard platform unless proper reason is given
This commit is contained in:
@@ -115,14 +115,6 @@ bool ffParseBatteryCommandOptions(FFBatteryOptions* options, const char* key, co
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
if (ffStrEqualsIgnCase(subKey, "dir"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->dir);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
if (ffStrEqualsIgnCase(subKey, "use-setup-api"))
|
||||
{
|
||||
@@ -147,14 +139,6 @@ void ffParseBatteryJsonObject(FFBatteryOptions* options, yyjson_val* module)
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
#ifdef __linux__
|
||||
if (ffStrEqualsIgnCase(key, "dir"))
|
||||
{
|
||||
ffStrbufSetS(&options->dir, yyjson_get_str(val));
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
if (ffStrEqualsIgnCase(key, "useSetupApi"))
|
||||
{
|
||||
@@ -180,11 +164,6 @@ void ffGenerateBatteryJsonConfig(FFBatteryOptions* options, yyjson_mut_doc* doc,
|
||||
|
||||
ffJsonConfigGenerateModuleArgsConfig(doc, module, &defaultOptions.moduleArgs, &options->moduleArgs);
|
||||
|
||||
#ifdef __linux__
|
||||
if (!ffStrbufEqual(&defaultOptions.dir, &options->dir))
|
||||
yyjson_mut_obj_add_strbuf(doc, module, "dir", &options->dir);
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
if (defaultOptions.useSetupApi != options->useSetupApi)
|
||||
yyjson_mut_obj_add_bool(doc, module, "useSetupApi", options->useSetupApi);
|
||||
@@ -257,9 +236,7 @@ void ffInitBatteryOptions(FFBatteryOptions* options)
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->temp = false;
|
||||
|
||||
#ifdef __linux__
|
||||
ffStrbufInitStatic(&options->dir, "/sys/class/power_supply/");
|
||||
#elif defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
options->useSetupApi = false;
|
||||
#endif
|
||||
}
|
||||
@@ -267,8 +244,4 @@ void ffInitBatteryOptions(FFBatteryOptions* options)
|
||||
void ffDestroyBatteryOptions(FFBatteryOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
|
||||
#ifdef __linux__
|
||||
ffStrbufDestroy(&options->dir);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -11,9 +11,7 @@ typedef struct FFBatteryOptions
|
||||
|
||||
bool temp;
|
||||
|
||||
#ifdef __linux__
|
||||
FFstrbuf dir;
|
||||
#elif defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
bool useSetupApi;
|
||||
#endif
|
||||
} FFBatteryOptions;
|
||||
|
||||
Reference in New Issue
Block a user