diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-08-14 15:30:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-14 15:30:43 +0200 |
commit | 6f025dc4d374e159d4d23ad52511e543ef38d112 (patch) | |
tree | 8e5f4b9dc17e114a09ec7b2622715423c13d6bce | |
parent | affc781d7225acc95ec4b30fdfc313ae3ea4e6cb (diff) | |
parent | 6188388c5a9c7f9fcc0b7f3928f176a9047b9a45 (diff) |
Merge pull request #20993 from Chaosus/fix_folder_deleting
Fix impossibility of removing folder which contains non-latin symbols
-rw-r--r-- | platform/windows/os_windows.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 033654323b..d6cfd039d9 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2789,23 +2789,17 @@ bool OS_Windows::is_disable_crash_handler() const { } Error OS_Windows::move_to_trash(const String &p_path) { - SHFILEOPSTRUCTA sf; - TCHAR *from = new TCHAR[p_path.length() + 2]; - strcpy(from, p_path.utf8().get_data()); - from[p_path.length()] = 0; - from[p_path.length() + 1] = 0; - + SHFILEOPSTRUCTW sf; sf.hwnd = hWnd; sf.wFunc = FO_DELETE; - sf.pFrom = from; + sf.pFrom = p_path.c_str(); sf.pTo = NULL; sf.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION; sf.fAnyOperationsAborted = FALSE; sf.hNameMappings = NULL; sf.lpszProgressTitle = NULL; - int ret = SHFileOperation(&sf); - delete[] from; + int ret = SHFileOperationW(&sf); if (ret) { ERR_PRINTS("SHFileOperation error: " + itos(ret)); |