mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Second round of fixes for FFPlatform
This commit is contained in:
@@ -46,6 +46,8 @@ static const char* getOsNameByWinbrand(FFstrbuf* osName)
|
||||
extern "C"
|
||||
void ffDetectOSImpl(FFOSResult* os, const FFinstance* instance)
|
||||
{
|
||||
FF_UNUSED(instance);
|
||||
|
||||
ffStrbufInit(&os->name);
|
||||
ffStrbufInit(&os->prettyName);
|
||||
ffStrbufInit(&os->id);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <netdb.h>
|
||||
|
||||
static void getHomeDir(FFPlatform* platform, const struct passwd* pwd)
|
||||
{
|
||||
@@ -40,7 +39,7 @@ static void getConfigDirs(FFPlatform* platform)
|
||||
ffPlatformPathAddHome(&platform->configDirs, platform, ".config/");
|
||||
|
||||
#if defined(__APPLE__)
|
||||
pathsAddHome(&state->configDirs, state, "/Library/Preferences/");
|
||||
ffPlatformPathAddHome(&state->configDirs, platform, "/Library/Preferences/");
|
||||
#endif
|
||||
|
||||
ffPlatformPathAddHome(&platform->configDirs, platform, "");
|
||||
@@ -58,6 +57,11 @@ static void getDataDirs(FFPlatform* platform)
|
||||
{
|
||||
ffPlatformPathAddEnv(&platform->dataDirs, "XDG_DATA_HOME");
|
||||
ffPlatformPathAddHome(&platform->dataDirs, platform, ".local/share/");
|
||||
|
||||
#if defined(__APPLE__)
|
||||
ffPlatformPathAddHome(&platform->dataDirs, platform, "/Library/Application Support/");
|
||||
#endif
|
||||
|
||||
ffPlatformPathAddHome(&platform->dataDirs, platform, "");
|
||||
ffPlatformPathAddEnv(&platform->dataDirs, "XDG_DATA_DIRS");
|
||||
ffPlatformPathAddAbsolute(&platform->dataDirs, FASTFETCH_TARGET_DIR_USR"/local/share/");
|
||||
@@ -83,6 +87,8 @@ static void getHostName(FFPlatform* platform, const struct utsname* uts)
|
||||
ffStrbufAppendS(&platform->hostName, uts->nodename);
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
#include <netdb.h>
|
||||
static void getDomainName(FFPlatform* platform)
|
||||
{
|
||||
struct addrinfo hints = {0};
|
||||
@@ -103,6 +109,7 @@ static void getDomainName(FFPlatform* platform)
|
||||
|
||||
freeaddrinfo(info);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void getUserShell(FFPlatform* platform, const struct passwd* pwd)
|
||||
{
|
||||
|
||||
@@ -11,9 +11,9 @@ static void getHomeDir(FFPlatform* platform)
|
||||
PWSTR pPath;
|
||||
if(SUCCEEDED(SHGetKnownFolderPath(&FOLDERID_Profile, KF_FLAG_DEFAULT, NULL, &pPath)))
|
||||
{
|
||||
ffStrbufSetWS(&platform->home_dir, pPath);
|
||||
ffStrbufReplaceAllC(&platform->home_dir, '\\', '/');
|
||||
ffStrbufEnsureEndsWithC(&platform->home_dir, '/');
|
||||
ffStrbufSetWS(&platform->homeDir, pPath);
|
||||
ffStrbufReplaceAllC(&platform->homeDir, '\\', '/');
|
||||
ffStrbufEnsureEndsWithC(&platform->homeDir, '/');
|
||||
}
|
||||
CoTaskMemFree(pPath);
|
||||
}
|
||||
@@ -23,18 +23,18 @@ static void getCacheDir(FFPlatform* platform)
|
||||
PWSTR pPath;
|
||||
if(SUCCEEDED(SHGetKnownFolderPath(&FOLDERID_LocalAppData, KF_FLAG_DEFAULT, NULL, &pPath)))
|
||||
{
|
||||
ffStrbufSetWS(&platform->cache_dir, pPath);
|
||||
ffStrbufReplaceAllC(&platform->cache_dir, '\\', '/');
|
||||
ffStrbufEnsureEndsWithC(&platform->cache_dir, '/');
|
||||
ffStrbufSetWS(&platform->cacheDir, pPath);
|
||||
ffStrbufReplaceAllC(&platform->cacheDir, '\\', '/');
|
||||
ffStrbufEnsureEndsWithC(&platform->cacheDir, '/');
|
||||
}
|
||||
else
|
||||
{
|
||||
ffStrbufAppend(&platform->cache_dir, &platform->home_dir);
|
||||
ffStrbufAppendS(&platform->cache_dir, "AppData/Local/");
|
||||
ffStrbufAppend(&platform->cacheDir, &platform->homeDir);
|
||||
ffStrbufAppendS(&platform->cacheDir, "AppData/Local/");
|
||||
}
|
||||
CoTaskMemFree(pPath);
|
||||
|
||||
ffStrbufAppendS(&platform->cache_dir, "fastfetch/");
|
||||
ffStrbufAppendS(&platform->cacheDir, "fastfetch/");
|
||||
}
|
||||
|
||||
static void platformPathAddKnownFolder(FFlist* dirs, REFKNOWNFOLDERID folderId)
|
||||
|
||||
Reference in New Issue
Block a user