Skip to content

Commit

Permalink
Fix ExpandUserFromString
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilledheart committed Nov 27, 2023
1 parent 1633c74 commit c733c44
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ std::wstring ExpandUserFromString(const std::wstring& path) {
}

std::wstring expanded_path;
expanded_path.resize(required_size);
expanded_path.resize(required_size - 1);
::ExpandEnvironmentStringsW(path.c_str(), &expanded_path[0], required_size);
while (!expanded_path.empty() && expanded_path[expanded_path.size() - 1] == L'\0') {
expanded_path.resize(expanded_path.size() - 1);
}

return expanded_path;
}
Expand Down

0 comments on commit c733c44

Please sign in to comment.