MCPcopy Create free account
hub / github.com/HO-COOH/FastCopy / Move

Function Move

FastCopy/ShellCopy.cpp:17–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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}

Callers 1

StartMethod · 0.85

Calls 4

ToBackslashFunction · 0.85
dataMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected