Set error using function hresult

This commit is contained in:
kyle-sylvestre authored and Sam Lantinga committed 2024-10-23 10:53:46 -07:00
1 parent 6eca02a0e7
commit 22bc430bbb
1 file changed
+4 -2
+4 -2
View File
@@ -102,6 +102,7 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
* NULL, &wszPath);
*/
HRESULT hr = E_FAIL;
WCHAR path[MAX_PATH];
char *result = NULL;
WCHAR *worg = NULL;
@@ -117,8 +118,9 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
org = "";
}
if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, path))) {
WIN_SetError("Couldn't locate our prefpath");
hr = SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, path);
if (!SUCCEEDED(hr)) {
WIN_SetErrorFromHRESULT("Couldn't locate our prefpath", hr);
return NULL;
}