From 3ef3cca76b62cbffe49c231212bac3d43e31c427 Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Sun, 15 Jan 2023 16:06:50 +0100 Subject: [PATCH] First round of fixes for FFPlatform --- CMakeLists.txt | 2 -- src/detection/packages/packages_windows.c | 2 +- src/detection/terminalfont/terminalfont_apple.m | 4 ++-- src/detection/wmtheme/wmtheme_apple.m | 2 +- src/util/platform/FFPlatform.c | 2 +- src/util/platform/FFPlatform_private.h | 2 +- src/util/platform/FFPlatform_unix.c | 2 +- src/util/platform/FFPlatform_windows.c | 2 +- 8 files changed, 8 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 87c9c6b7b..2aeeef888 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ) diff --git a/src/detection/packages/packages_windows.c b/src/detection/packages/packages_windows.c index 93739e9bf..fa50bdd5b 100644 --- a/src/detection/packages/packages_windows.c +++ b/src/detection/packages/packages_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) diff --git a/src/detection/terminalfont/terminalfont_apple.m b/src/detection/terminalfont/terminalfont_apple.m index 1ee387aa2..71ecc8b22 100644 --- a/src/detection/terminalfont/terminalfont_apple.m +++ b/src/detection/terminalfont/terminalfont_apple.m @@ -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) diff --git a/src/detection/wmtheme/wmtheme_apple.m b/src/detection/wmtheme/wmtheme_apple.m index d0b099790..437d6ed97 100644 --- a/src/detection/wmtheme/wmtheme_apple.m +++ b/src/detection/wmtheme/wmtheme_apple.m @@ -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) diff --git a/src/util/platform/FFPlatform.c b/src/util/platform/FFPlatform.c index 9ea045736..aa59feda9 100644 --- a/src/util/platform/FFPlatform.c +++ b/src/util/platform/FFPlatform.c @@ -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); diff --git a/src/util/platform/FFPlatform_private.h b/src/util/platform/FFPlatform_private.h index c51d01d80..698f07609 100644 --- a/src/util/platform/FFPlatform_private.h +++ b/src/util/platform/FFPlatform_private.h @@ -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) \ diff --git a/src/util/platform/FFPlatform_unix.c b/src/util/platform/FFPlatform_unix.c index e5adaac95..e8025c49e 100644 --- a/src/util/platform/FFPlatform_unix.c +++ b/src/util/platform/FFPlatform_unix.c @@ -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()); diff --git a/src/util/platform/FFPlatform_windows.c b/src/util/platform/FFPlatform_windows.c index ade0087fc..6175cb3c2 100644 --- a/src/util/platform/FFPlatform_windows.c +++ b/src/util/platform/FFPlatform_windows.c @@ -211,7 +211,7 @@ static void getSystemArchitecture(FFPlatform* platform) } } -void ffPlatformInitÎmpl(FFPlatform* platform) +void ffPlatformInitImpl(FFPlatform* platform) { getHomeDir(platform); getCacheDir(platform);