| 15 | } |
| 16 | |
| 17 | bool Move(std::wstring_view source, std::wstring_view destination) |
| 18 | { |
| 19 | try |
| 20 | { |
| 21 | winrt::com_ptr<IFileOperation> pfo; |
| 22 | winrt::check_hresult(CoCreateInstance(CLSID_FileOperation, NULL, CLSCTX_ALL, IID_PPV_ARGS(pfo.put()))); |
| 23 | winrt::check_hresult(pfo->SetOperationFlags(FOF_NO_UI)); |
| 24 | |
| 25 | winrt::com_ptr<IShellItem> psiFrom = CreateItemFromParsingName(ToBackslash(source).data()), |
| 26 | psiDest = CreateItemFromParsingName(ToBackslash(destination).data()); |
| 27 | winrt::check_hresult(pfo->MoveItem(psiFrom.get(), psiDest.get(), nullptr, nullptr)); |
| 28 | winrt::check_hresult(pfo->PerformOperations()); |
| 29 | } |
| 30 | catch (...) { return false; } |
| 31 | |
| 32 | return true; |
| 33 | } |
| 34 | } |
no test coverage detected