diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-08-18 22:44:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-18 22:44:39 +0200 |
commit | 92401772c859207130aafcd0f2d24236600d76e0 (patch) | |
tree | 058516441268d654a31a36d1dfef66e4b53d3b05 /platform | |
parent | 8c7034459626f733c3765592e52bae250dfc7533 (diff) | |
parent | 42dc2ec0800debbcecef404dac9c0499f9c28bf0 (diff) |
Merge pull request #21132 from neonsoup/win_move_to_trash_fix
Fix errors during removing files or folders and fix for latin symbols
Diffstat (limited to 'platform')
-rw-r--r-- | platform/windows/os_windows.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index d6cfd039d9..d5bb85c035 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2790,9 +2790,13 @@ bool OS_Windows::is_disable_crash_handler() const { Error OS_Windows::move_to_trash(const String &p_path) { SHFILEOPSTRUCTW sf; + WCHAR *from = new WCHAR[p_path.length() + 2]; + wcscpy(from, p_path.c_str()); + from[p_path.length() + 1] = 0; + sf.hwnd = hWnd; sf.wFunc = FO_DELETE; - sf.pFrom = p_path.c_str(); + sf.pFrom = from; sf.pTo = NULL; sf.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION; sf.fAnyOperationsAborted = FALSE; @@ -2800,6 +2804,7 @@ Error OS_Windows::move_to_trash(const String &p_path) { sf.lpszProgressTitle = NULL; int ret = SHFileOperationW(&sf); + delete[] from; if (ret) { ERR_PRINTS("SHFileOperation error: " + itos(ret)); |