MCPcopy Create free account
hub / github.com/LibreVR/Revive / CopyFiles

Method CopyFiles

ReviveOverlay/windowsservices.cpp:38–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38bool WindowsServices::CopyFiles(QStringList files, QString destination, QStringList newName)
39{
40 Microsoft::WRL::ComPtr<IFileOperation> pfo;
41 HRESULT hr = CoCreateInstance(CLSID_FileOperation, nullptr, CLSCTX_ALL, IID_PPV_ARGS(&pfo));
42 if (SUCCEEDED(hr))
43 {
44 QString dstDir = QDir::toNativeSeparators(destination);
45 Microsoft::WRL::ComPtr<IShellItem> psiTo;
46 if (!dstDir.isEmpty())
47 {
48 hr = SHCreateItemFromParsingName(qUtf16Printable(dstDir),
49 NULL,
50 IID_PPV_ARGS(&psiTo));
51 }
52
53 for (QStringList::iterator file = files.begin(), name = newName.begin();
54 SUCCEEDED(hr) && file != files.end() && name != newName.end();
55 file++, name++)
56 {
57 QString src = QDir::toNativeSeparators(*file);
58 Microsoft::WRL::ComPtr<IShellItem> psiFrom;
59 hr = SHCreateItemFromParsingName(qUtf16Printable(src), NULL, IID_PPV_ARGS(&psiFrom));
60 if (SUCCEEDED(hr))
61 {
62 hr = pfo->CopyItem(
63 psiFrom.Get(),
64 psiTo.Get(),
65 name->isNull() ? nullptr : qUtf16Printable(*name),
66 nullptr);
67 }
68 }
69
70 if (SUCCEEDED(hr))
71 {
72 hr = pfo->PerformOperations();
73 }
74 }
75 return SUCCEEDED(hr);
76}
77
78const wchar_t* WindowsServices::CredTargetName = L"Revive/OculusPlatform";
79

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected