mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
First round of fixes for FFPlatform
This commit is contained in:
parent
a1d8e3e598
commit
3ef3cca76b
@ -495,10 +495,8 @@ elseif(WIN32)
|
||||
src/detection/wifi/wifi_windows.c
|
||||
src/detection/wmtheme/wmtheme_windows.c
|
||||
src/util/windows/getline.c
|
||||
src/util/windows/pwd.c
|
||||
src/util/windows/registry.c
|
||||
src/util/windows/unicode.c
|
||||
src/util/windows/utsname.c
|
||||
src/util/windows/wmi.cpp
|
||||
src/util/platform/FFPlatform_windows.c
|
||||
)
|
||||
|
@ -28,7 +28,7 @@ static uint32_t getNumElements(const char* searchPath /* including `\*` suffix *
|
||||
static void detectScoop(const FFinstance* instance, FFPackagesResult* result)
|
||||
{
|
||||
char scoopPath[MAX_PATH + 3];
|
||||
strcpy(scoopPath, instance->state.passwd->pw_dir);
|
||||
strcpy(scoopPath, instance->state.platform.homeDir.chars);
|
||||
strncat(scoopPath, "/scoop/apps/*", sizeof(scoopPath) - 1 - strlen(scoopPath));
|
||||
result->scoop = getNumElements(scoopPath, FILE_ATTRIBUTE_DIRECTORY);
|
||||
if(result->scoop > 0)
|
||||
|
@ -17,7 +17,7 @@ static void detectIterm2(const FFinstance* instance, FFTerminalFontResult* termi
|
||||
}
|
||||
|
||||
NSError* error;
|
||||
NSString* fileName = [NSString stringWithFormat:@"file://%s/Library/Preferences/com.googlecode.iterm2.plist", instance->state.passwd->pw_dir];
|
||||
NSString* fileName = [NSString stringWithFormat:@"file://%s/Library/Preferences/com.googlecode.iterm2.plist", instance->state.platform.homeDir.chars];
|
||||
NSDictionary* dict = [NSDictionary dictionaryWithContentsOfURL:[NSURL URLWithString:fileName]
|
||||
error:&error];
|
||||
if(error)
|
||||
@ -62,7 +62,7 @@ static void detectAppleTerminal(FFTerminalFontResult* terminalFont)
|
||||
static void detectWarpTerminal(const FFinstance* instance, FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
NSError* error;
|
||||
NSString* fileName = [NSString stringWithFormat:@"file://%s/Library/Preferences/dev.warp.Warp-Stable.plist", instance->state.passwd->pw_dir];
|
||||
NSString* fileName = [NSString stringWithFormat:@"file://%s/Library/Preferences/dev.warp.Warp-Stable.plist", instance->state.platform.homeDir.chars];
|
||||
NSDictionary* dict = [NSDictionary dictionaryWithContentsOfURL:[NSURL URLWithString:fileName]
|
||||
error:&error];
|
||||
if(error)
|
||||
|
@ -9,7 +9,7 @@ static bool detectQuartzCompositor(FFinstance* instance, FFstrbuf* themeOrError)
|
||||
FF_UNUSED(instance);
|
||||
|
||||
NSError* error;
|
||||
NSString* fileName = [NSString stringWithFormat:@"file://%s/Library/Preferences/.GlobalPreferences.plist", instance->state.passwd->pw_dir];
|
||||
NSString* fileName = [NSString stringWithFormat:@"file://%s/Library/Preferences/.GlobalPreferences.plist", instance->state.platform.homeDir.chars];
|
||||
NSDictionary* dict = [NSDictionary dictionaryWithContentsOfURL:[NSURL URLWithString:fileName]
|
||||
error:&error];
|
||||
if(error)
|
||||
|
@ -17,7 +17,7 @@ void ffPlatformInit(FFPlatform* platform)
|
||||
ffStrbufInit(&platform->systemVersion);
|
||||
ffStrbufInit(&platform->systemArchitecture);
|
||||
|
||||
ffPlatformInitÎmpl(platform);
|
||||
ffPlatformInitImpl(platform);
|
||||
|
||||
if(platform->domainName.length == 0)
|
||||
ffStrbufAppend(&platform->domainName, &platform->hostName);
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "FFPlatform.h"
|
||||
|
||||
void ffPlatformInitÎmpl(FFPlatform* platform);
|
||||
void ffPlatformInitImpl(FFPlatform* platform);
|
||||
|
||||
#define FF_PLATFORM_PATH_UNIQUE(list, element) \
|
||||
if(ffListFirstIndexComp(list, element, (bool(*)(const void*, const void*))ffStrbufEqual) < list->length - 1) \
|
||||
|
@ -113,7 +113,7 @@ static void getUserShell(FFPlatform* platform, const struct passwd* pwd)
|
||||
ffStrbufAppendS(&platform->userShell, shell);
|
||||
}
|
||||
|
||||
void ffPlatformInitÎmpl(FFPlatform* platform)
|
||||
void ffPlatformInitImpl(FFPlatform* platform)
|
||||
{
|
||||
struct passwd* pwd = getpwuid(getuid());
|
||||
|
||||
|
@ -211,7 +211,7 @@ static void getSystemArchitecture(FFPlatform* platform)
|
||||
}
|
||||
}
|
||||
|
||||
void ffPlatformInitÎmpl(FFPlatform* platform)
|
||||
void ffPlatformInitImpl(FFPlatform* platform)
|
||||
{
|
||||
getHomeDir(platform);
|
||||
getCacheDir(platform);
|
||||
|
Loading…
x
Reference in New Issue
Block a user