From c1d92206f50bbbd0bf3f39786d66642a447f3b8e Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Sun, 15 Jan 2023 16:45:16 +0100 Subject: [PATCH] Third round of fixes for FFPlatform --- src/util/platform/FFPlatform_unix.c | 8 ++++++-- src/util/platform/FFPlatform_windows.c | 16 ++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/util/platform/FFPlatform_unix.c b/src/util/platform/FFPlatform_unix.c index aa019acb0..3d13042fc 100644 --- a/src/util/platform/FFPlatform_unix.c +++ b/src/util/platform/FFPlatform_unix.c @@ -39,7 +39,7 @@ static void getConfigDirs(FFPlatform* platform) ffPlatformPathAddHome(&platform->configDirs, platform, ".config/"); #if defined(__APPLE__) - ffPlatformPathAddHome(&state->configDirs, platform, "/Library/Preferences/"); + ffPlatformPathAddHome(&platform->configDirs, platform, "/Library/Preferences/"); #endif ffPlatformPathAddHome(&platform->configDirs, platform, ""); @@ -135,7 +135,11 @@ void ffPlatformInitImpl(FFPlatform* platform) getUserName(platform, pwd); getHostName(platform, &uts); - getDomainName(platform); + + #ifdef __linux__ + getDomainName(platform); + #endif + getUserShell(platform, pwd); ffStrbufAppendS(&platform->systemName, uts.sysname); diff --git a/src/util/platform/FFPlatform_windows.c b/src/util/platform/FFPlatform_windows.c index 4f09b89f1..b1ad2bef8 100644 --- a/src/util/platform/FFPlatform_windows.c +++ b/src/util/platform/FFPlatform_windows.c @@ -88,7 +88,7 @@ static void getConfigDirs(FFPlatform* platform) ffPlatformPathAddEnv(&platform->configDirs, "XDG_CONFIG_DIRS"); } -static void getConfigDirs(FFPlatform* platform) +static void getDataDirs(FFPlatform* platform) { ffPlatformPathAddEnv(&platform->dataDirs, "XDG_DATA_HOME"); ffPlatformPathAddHome(&platform->dataDirs, platform, "/.local/share/"); @@ -185,25 +185,25 @@ static void getSystemArchitecture(FFPlatform* platform) switch(sysInfo.wProcessorArchitecture) { case PROCESSOR_ARCHITECTURE_AMD64: - strcpy(name->machine, "x86_64"); + ffStrbufAppendS(&platform->systemArchitecture, "x86_64"); break; case PROCESSOR_ARCHITECTURE_IA64: - strcpy(name->machine, "ia64"); + ffStrbufAppendS(&platform->systemArchitecture, "ia64"); break; case PROCESSOR_ARCHITECTURE_INTEL: - strcpy(name->machine, "x86"); + ffStrbufAppendS(&platform->systemArchitecture, "i686"); break; case PROCESSOR_ARCHITECTURE_ARM64: - strcpy(name->machine, "aarch64"); + ffStrbufAppendS(&platform->systemArchitecture, "aarch64"); break; case PROCESSOR_ARCHITECTURE_ARM: - strcpy(name->machine, "arm"); + ffStrbufAppendS(&platform->systemArchitecture, "arm"); break; case PROCESSOR_ARCHITECTURE_PPC: - strcpy(name->machine, "ppc"); + ffStrbufAppendS(&platform->systemArchitecture, "ppc"); break; case PROCESSOR_ARCHITECTURE_MIPS: - strcpy(name->machine, "mips"); + ffStrbufAppendS(&platform->systemArchitecture, "mips"); break; case PROCESSOR_ARCHITECTURE_UNKNOWN: default: