Merge pull request #289 from CarterLi/dev

Make CI actually work on Windows
This commit is contained in:
Linus Dierheimer
2022-10-11 19:22:48 +02:00
committed by GitHub
10 changed files with 48 additions and 27 deletions
+5 -6
View File
@@ -171,14 +171,13 @@ jobs:
run: cmake --build . --target fastfetch --target flashfetch # Makes no sense to install exes to /usr/bin for Windows
- name: copy necessary dlls
run: cp /usr/bin/msys-2.0.dll /clang64/bin/*.dll .
run: cp /usr/bin/msys-2.0.dll /clang64/bin/{libcjson,libOpenCL,vulkan-1}.dll .
# Crashes on start for some reason, but it provides binaries at least. Needs investigation.
# - name: run fastfetch
# run: ./fastfetch --recache --disable-linewrap false --hide-cursor false --show-errors true --load-config presets/all
- name: run fastfetch
run: ./fastfetch --recache --disable-linewrap false --hide-cursor false --show-errors true --load-config presets/all
# - name: run flashfetch
# run: ./flashfetch
- name: run flashfetch
run: ./flashfetch
- name: upload artifacts
uses: actions/upload-artifact@v3
+4 -2
View File
@@ -26,7 +26,7 @@ const char* ffDetectBatteryImpl(FFinstance* instance, FFlist* results)
ffStrbufInit(&battery->modelName);
ffGetWmiObjString(pclsObj, L"Name", &battery->modelName);
uint64_t chemistry;
uint64_t chemistry = 0;
ffGetWmiObjUnsigned(pclsObj, L"Chemistry", &chemistry);
switch(chemistry)
{
@@ -38,6 +38,7 @@ const char* ffDetectBatteryImpl(FFinstance* instance, FFlist* results)
case 6: ffStrbufInitS(&battery->technology, "Lithium-ion"); break;
case 7: ffStrbufInitS(&battery->technology, "Zinc air"); break;
case 8: ffStrbufInitS(&battery->technology, "Lithium Polymer"); break;
default: ffStrbufInit(&battery->technology); break;
}
uint64_t capacity;
@@ -59,12 +60,13 @@ const char* ffDetectBatteryImpl(FFinstance* instance, FFlist* results)
case 9: ffStrbufInitS(&battery->status, "Charging and Critical"); break;
case 10: ffStrbufInitS(&battery->status, "Undefined"); break;
case 11: ffStrbufInitS(&battery->status, "Partially Charged"); break;
default: ffStrbufInit(&battery->status); break;
}
battery->temperature = FF_BATTERY_TEMP_UNSET;
}
pclsObj->Release();
if(pclsObj) pclsObj->Release();
pEnumerator->Release();
return nullptr;
}
+1 -3
View File
@@ -19,9 +19,7 @@ void ffDetectFontImpl(const FFinstance* instance, FFFontResult* result)
IWbemClassObject *pclsObj = NULL;
ULONG uReturn = 0;
pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn);
if(uReturn == 0)
if(FAILED(pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn)) || uReturn == 0)
{
ffStrbufInitS(&result->error, "No WMI result returned");
pEnumerator->Release();
+1 -1
View File
@@ -38,7 +38,7 @@ const char* ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance)
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
}
pclsObj->Release();
if(pclsObj) pclsObj->Release();
pEnumerator->Release();
return nullptr;
}
+1 -3
View File
@@ -23,9 +23,7 @@ extern "C" void ffDetectHostImpl(FFHostResult* host)
IWbemClassObject *pclsObj = NULL;
ULONG uReturn = 0;
pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn);
if(uReturn == 0)
if(FAILED(pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn)) || uReturn == 0)
{
ffStrbufInitS(&host->error, "No Wmi result returned");
pEnumerator->Release();
+12 -5
View File
@@ -10,11 +10,18 @@ static void addNewIp(FFlist* list, const wchar_t* name, const char* addr, bool i
FFLocalIpResult* ip = (FFLocalIpResult*) ffListAdd(list);
int len = (int)wcslen(name);
int size_needed = WideCharToMultiByte(CP_UTF8, 0, name, len, NULL, 0, NULL, NULL);
ffStrbufInitA(&ip->name, (uint32_t)size_needed + 1);
WideCharToMultiByte(CP_UTF8, 0, name, len, ip->name.chars, size_needed, NULL, NULL);
ip->name.length = (uint32_t)size_needed;
ip->name.chars[size_needed] = '\0';
if(len > 0)
{
int size_needed = WideCharToMultiByte(CP_UTF8, 0, name, len, NULL, 0, NULL, NULL);
ffStrbufInitA(&ip->name, (uint32_t)size_needed + 1);
WideCharToMultiByte(CP_UTF8, 0, name, len, ip->name.chars, size_needed, NULL, NULL);
ip->name.length = (uint32_t)size_needed;
ip->name.chars[size_needed] = '\0';
}
else
{
ffStrbufInitS(&ip->name, "*");
}
ffStrbufInitS(&ip->addr, addr);
ip->ipv6 = ipv6;
+10 -2
View File
@@ -33,13 +33,21 @@ void ffDetectOSImpl(FFOSResult* os, const FFinstance* instance)
return;
}
ffGetWmiObjString(pclsObj, L"Caption", &os->variant); // Microsoft Windows 11 家庭中文版
ffGetWmiObjString(pclsObj, L"Caption", &os->variant);
if(ffStrbufStartsWithS(&os->variant, "Microsoft Windows "))
{
ffStrbufAppendS(&os->name, "Microsoft Windows");
ffStrbufAppendS(&os->prettyName, "Windows");
ffStrbufSubstrAfter(&os->variant, strlen("Microsoft Windows ") - 1); // 11 家庭中文版
ffStrbufSubstrAfter(&os->variant, strlen("Microsoft Windows ") - 1);
if(ffStrbufStartsWithS(&os->variant, "Server "))
{
ffStrbufAppendS(&os->name, " Server");
ffStrbufAppendS(&os->prettyName, " Server");
ffStrbufSubstrAfter(&os->variant, strlen(" Server") - 1);
}
uint32_t index = ffStrbufFirstIndexC(&os->variant, ' ');
ffStrbufAppendNS(&os->version, index, os->variant.chars);
ffStrbufSubstrAfter(&os->variant, index);
@@ -77,8 +77,15 @@ static uint32_t getShellInfo(FFTerminalShellResult* result, uint32_t pid)
}
else if(ffStrbufIgnCaseCompS(&result->shellPrettyName, "powershell") == 0)
ffStrbufSetS(&result->shellPrettyName, "Windows PowerShell");
else if(ffStrbufIgnCaseCompS(&result->shellPrettyName, "powershell_ise") == 0)
ffStrbufSetS(&result->shellPrettyName, "Windows PowerShell ISE");
else if(ffStrbufIgnCaseCompS(&result->shellPrettyName, "cmd") == 0)
ffStrbufSetS(&result->shellPrettyName, "Command Prompt");
else if(ffStrbufIgnCaseCompS(&result->terminalPrettyName, "explorer") == 0)
{
ffStrbufSetS(&result->terminalPrettyName, "Windows Explorer"); // Started without shell
return 0;
}
return ppid;
}
@@ -99,6 +106,8 @@ static uint32_t getTerminalInfo(FFTerminalShellResult* result, uint32_t pid)
ffStrbufSetS(&result->terminalPrettyName, "Windows Terminal");
else if(ffStrbufIgnCaseCompS(&result->terminalPrettyName, "conhost") == 0)
ffStrbufSetS(&result->terminalPrettyName, "Console Window Host");
else if(ffStrbufIgnCaseCompS(&result->terminalPrettyName, "explorer") == 0)
ffStrbufSetS(&result->terminalPrettyName, "Windows Explorer");
return ppid;
}
@@ -148,7 +157,6 @@ const FFTerminalShellResult* ffDetectTerminalShell(const FFinstance* instance)
return &result;
// TODO: handle nested shells
// TODO: handle running without shells ( dblclick exe in Windows Explorer )
ppid = getTerminalInfo(&result, ppid);
if(ppid == 0)
+1 -1
View File
@@ -37,6 +37,6 @@ next:
if(users->length == 0)
ffStrbufAppendS(error, "Unable to detect users");
pclsObj->Release();
if(pclsObj) pclsObj->Release();
pEnumerator->Release();
}
+4 -3
View File
@@ -2,6 +2,7 @@
#include <synchapi.h>
#include <wchar.h>
#include <math.h>
//https://learn.microsoft.com/en-us/windows/win32/wmisdk/example--getting-wmi-data-from-the-local-computer
//https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/computer-system-hardware-classes
@@ -232,7 +233,7 @@ bool ffGetWmiObjSigned(IWbemClassObject* obj, const wchar_t* key, int64_t* integ
case VT_UI4: *integer = (int64_t)vtProp.uintVal; break;
case VT_UI8: *integer = (int64_t)vtProp.ullVal; break;
case VT_BOOL: *integer = vtProp.boolVal != VARIANT_FALSE; break;
default: result = false;
default: *integer = 0; result = false;
}
}
VariantClear(&vtProp);
@@ -266,7 +267,7 @@ bool ffGetWmiObjUnsigned(IWbemClassObject* obj, const wchar_t* key, uint64_t* in
case VT_UI4: *integer = vtProp.uintVal; break;
case VT_UI8: *integer = vtProp.ullVal; break;
case VT_BOOL: *integer = vtProp.boolVal != VARIANT_FALSE; break;
default: result = false;
default: *integer = 0; result = false;
}
}
VariantClear(&vtProp);
@@ -302,7 +303,7 @@ bool ffGetWmiObjReal(IWbemClassObject* obj, const wchar_t* key, double* real)
case VT_R4: *real = vtProp.fltVal; break;
case VT_R8: *real = vtProp.dblVal; break;
case VT_BOOL: *real = vtProp.boolVal != VARIANT_FALSE; break;
default: result = false;
default: *real = NAN; result = false;
}
}
VariantClear(&vtProp);