mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-31 18:13:38 +01:00
Windows: look for config files in $LOCALAPPDATA
This commit is contained in:
@@ -328,6 +328,12 @@ uint32_t ffStrbufPreviousIndexC(const FFstrbuf* strbuf, uint32_t start, char c)
|
||||
return strbuf->length;
|
||||
}
|
||||
|
||||
void ffStrbufReplaceAllC(FFstrbuf* strbuf, char find, char replace)
|
||||
{
|
||||
for (char *current_pos = strchr(strbuf->chars, find); current_pos; current_pos = strchr(current_pos + 1, find))
|
||||
*current_pos = replace;
|
||||
}
|
||||
|
||||
void ffStrbufSubstrBefore(FFstrbuf* strbuf, uint32_t index)
|
||||
{
|
||||
if(strbuf->length <= index)
|
||||
|
||||
@@ -69,6 +69,8 @@ FF_C_NODISCARD uint32_t ffStrbufNextIndexS(const FFstrbuf* strbuf, uint32_t star
|
||||
|
||||
FF_C_NODISCARD uint32_t ffStrbufPreviousIndexC(const FFstrbuf* strbuf, uint32_t start, char c);
|
||||
|
||||
void ffStrbufReplaceAllC(FFstrbuf* strbuf, char find, char replace);
|
||||
|
||||
void ffStrbufSubstrBefore(FFstrbuf* strbuf, uint32_t index);
|
||||
void ffStrbufSubstrBeforeFirstC(FFstrbuf* strbuf, char c);
|
||||
void ffStrbufSubstrBeforeLastC(FFstrbuf* strbuf, char c);
|
||||
|
||||
@@ -11,7 +11,12 @@ struct passwd* ffGetPasswd()
|
||||
DWORD len = sizeof(res.pw_name);
|
||||
GetUserNameA(res.pw_name, &len);
|
||||
|
||||
SHGetFolderPathA(NULL, CSIDL_PROFILE, NULL, 0, res.pw_dir);
|
||||
PWSTR pPath;
|
||||
if(SUCCEEDED(SHGetKnownFolderPath(&FOLDERID_Profile, KF_FLAG_DEFAULT, NULL, &pPath)))
|
||||
WideCharToMultiByte(CP_UTF8, 0, pPath, -1, res.pw_dir, sizeof(res.pw_dir), NULL, NULL); //res has been NULL inited
|
||||
CoTaskMemFree(pPath);
|
||||
for (char *current_pos = strchr(res.pw_dir, '\\'); current_pos; current_pos = strchr(current_pos + 1, '\\'))
|
||||
*current_pos = '/';
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user