Set error using function hresult

This commit is contained in:
kyle-sylvestre
2024-10-23 13:32:32 -04:00
committed by Sam Lantinga
parent 6eca02a0e7
commit 22bc430bbb

View File

@@ -102,6 +102,7 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
* NULL, &wszPath); * NULL, &wszPath);
*/ */
HRESULT hr = E_FAIL;
WCHAR path[MAX_PATH]; WCHAR path[MAX_PATH];
char *result = NULL; char *result = NULL;
WCHAR *worg = NULL; WCHAR *worg = NULL;
@@ -117,8 +118,9 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
org = ""; org = "";
} }
if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, path))) { hr = SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, path);
WIN_SetError("Couldn't locate our prefpath"); if (!SUCCEEDED(hr)) {
WIN_SetErrorFromHRESULT("Couldn't locate our prefpath", hr);
return NULL; return NULL;
} }