Removed unwanted generation of temp strings.

This commit is contained in:
Steffen Schümann 2021-06-14 21:34:37 +02:00
parent cd68567543
commit b3d9a50bb5

View File

@ -1895,9 +1895,9 @@ GHC_INLINE void create_symlink(const path& target_name, const path& new_symlink,
#pragma GCC diagnostic pop
#endif
if (api_call) {
if (api_call(detail::fromUtf8<std::wstring>(new_symlink.u8string()).c_str(), detail::fromUtf8<std::wstring>(target_name.u8string()).c_str(), to_directory ? 1 : 0) == 0) {
if (api_call(GHC_NATIVEWP(new_symlink), GHC_NATIVEWP(target_name), to_directory ? 1 : 0) == 0) {
auto result = ::GetLastError();
if (result == ERROR_PRIVILEGE_NOT_HELD && api_call(detail::fromUtf8<std::wstring>(new_symlink.u8string()).c_str(), detail::fromUtf8<std::wstring>(target_name.u8string()).c_str(), to_directory ? 3 : 2) != 0) {
if (result == ERROR_PRIVILEGE_NOT_HELD && api_call(GHC_NATIVEWP(new_symlink), GHC_NATIVEWP(target_name), to_directory ? 3 : 2) != 0) {
return;
}
ec = detail::make_system_error(result);