Skip to content

Commit

Permalink
Convert use of deprecated SHGetFolderPathW to SHGetKnownFolderPath
Browse files Browse the repository at this point in the history
(cherry-picked from commit 497d58d)
  • Loading branch information
Vultraz committed Oct 7, 2018
1 parent 7cefbac commit d053a87
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/filesystem_boost.cpp
Expand Up @@ -554,12 +554,9 @@ void set_user_data_dir(std::string newprefdir)
newprefdir = "Wesnoth" + get_version_path_suffix();
}

wchar_t docs_path[MAX_PATH];
PWSTR docs_path = nullptr;
HRESULT res = SHGetKnownFolderPath(FOLDERID_Documents, KF_FLAG_CREATE, nullptr, &docs_path);

HRESULT res = SHGetFolderPathW(nullptr,
CSIDL_PERSONAL | CSIDL_FLAG_CREATE, nullptr,
SHGFP_TYPE_CURRENT,
docs_path);
if(res != S_OK) {
//
// Crummy fallback path full of pain and suffering.
Expand Down

0 comments on commit d053a87

Please sign in to comment.