mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-08 22:20:17 +01:00
IO: don't require posix specific stuff for ffPathExists
This commit is contained in:
@@ -131,7 +131,7 @@ void ffDetectCPUImpl(const FFinstance* instance, FFCPUResult* cpu)
|
||||
cpu->coresOnline = (uint16_t) get_nprocs();
|
||||
|
||||
#define BP "/sys/devices/system/cpu/cpufreq/policy0/"
|
||||
if(ffFileExists(BP, S_IFDIR))
|
||||
if(ffPathExists(BP, FF_PATHTYPE_DIRECTORY))
|
||||
{
|
||||
cpu->frequencyMin = getFrequency(BP"cpuinfo_min_freq", BP"scaling_min_freq");
|
||||
cpu->frequencyMax = getFrequency(BP"cpuinfo_max_freq", BP"scaling_max_freq");
|
||||
|
||||
@@ -48,7 +48,7 @@ static const char* parseEnv()
|
||||
|
||||
if(
|
||||
getenv("WAYLAND_DISPLAY") != NULL &&
|
||||
ffFileExists("/mnt/wslg/", S_IFDIR)
|
||||
ffPathExists("/mnt/wslg/", FF_PATHTYPE_DIRECTORY)
|
||||
) return "WSLg";
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -88,7 +88,7 @@ static uint32_t countFilesRecursiveImpl(FFstrbuf* baseDirPath, const char* filen
|
||||
|
||||
ffStrbufAppendC(baseDirPath, '/');
|
||||
ffStrbufAppendS(baseDirPath, filename);
|
||||
bool exists = ffFileExists(baseDirPath->chars, S_IFREG);
|
||||
bool exists = ffPathExists(baseDirPath->chars, FF_PATHTYPE_FILE);
|
||||
ffStrbufSubstrBefore(baseDirPath, baseDirPathLength);
|
||||
if(exists)
|
||||
return 1;
|
||||
@@ -129,7 +129,7 @@ static uint32_t countFilesRecursive(FFstrbuf* baseDir, const char* dirname, cons
|
||||
static uint32_t getNixPackagesImpl(char* path)
|
||||
{
|
||||
//Nix detection is kinda slow, so we only do it if the dir exists
|
||||
if(!ffFileExists(path, S_IFDIR))
|
||||
if(!ffPathExists(path, FF_PATHTYPE_DIRECTORY))
|
||||
return 0;
|
||||
|
||||
FFstrbuf output;
|
||||
|
||||
@@ -62,7 +62,7 @@ void ffDetectTerminalFontPlatform(const FFinstance* instance, const FFTerminalSh
|
||||
return;
|
||||
}
|
||||
|
||||
if(!ffFileExists(FF_TERMUX_FONT_PATH, S_IFREG))
|
||||
if(!ffPathExists(FF_TERMUX_FONT_PATH, FF_PATHTYPE_FILE))
|
||||
{
|
||||
ffFontInitCopy(&terminalFont->font, "monospace");
|
||||
return;
|
||||
|
||||
@@ -219,7 +219,7 @@ static const char* detectWifiWithIoctls(FF_MAYBE_UNUSED const FFinstance* instan
|
||||
for(struct if_nameindex* i = infs; !(i->if_index == 0 && i->if_name == NULL); ++i)
|
||||
{
|
||||
ffStrbufSetF(&path, "/sys/class/net/%s/phy80211", i->if_name);
|
||||
if(!ffFileExists(path.chars, S_IFDIR))
|
||||
if(!ffPathExists(path.chars, FF_PATHTYPE_DIRECTORY))
|
||||
continue;
|
||||
|
||||
FFWifiResult* item = (FFWifiResult*)ffListAdd(result);
|
||||
|
||||
Reference in New Issue
Block a user