mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Battery (Linux): tidy
This commit is contained in:
@@ -101,16 +101,8 @@ static void parseBattery(FFstrbuf* dir, const char* id, FFBatteryOptions* option
|
||||
const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY baseDir = ffStrbufCreateA(64);
|
||||
|
||||
if(options->dir.length > 0)
|
||||
{
|
||||
ffStrbufAppend(&baseDir, &options->dir);
|
||||
ffStrbufEnsureEndsWithC(&baseDir, '/');
|
||||
}
|
||||
else
|
||||
{
|
||||
ffStrbufAppendS(&baseDir, "/sys/class/power_supply/");
|
||||
}
|
||||
ffStrbufAppend(&baseDir, &options->dir);
|
||||
ffStrbufEnsureEndsWithC(&baseDir, '/');
|
||||
|
||||
uint32_t baseDirLength = baseDir.length;
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ void ffInitBatteryOptions(FFBatteryOptions* options)
|
||||
options->temp = false;
|
||||
|
||||
#ifdef __linux__
|
||||
ffStrbufInit(&options->dir);
|
||||
ffStrbufInitStatic(&options->dir, "/sys/class/power_supply/");
|
||||
#elif defined(_WIN32)
|
||||
options->useSetupApi = false;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user