| 13 | } |
| 14 | |
| 15 | bool Win32ApiTest::Run(std::vector<TestOperation> const& paths) |
| 16 | { |
| 17 | for (auto const& path : paths) |
| 18 | { |
| 19 | SHFILEOPSTRUCTW info{}; |
| 20 | switch (path.operation) |
| 21 | { |
| 22 | case TestOperation::Operation::Copy: info.wFunc = FO_COPY; break; |
| 23 | case TestOperation::Operation::Move: info.wFunc = FO_MOVE; break; |
| 24 | case TestOperation::Operation::Delete: info.wFunc = FO_DELETE; break; |
| 25 | default: |
| 26 | throw std::runtime_error{ "Unknown operation" }; |
| 27 | } |
| 28 | auto pFromBuffer = StringToMultiString(path.source); |
| 29 | info.pFrom = pFromBuffer.get(); |
| 30 | auto pToBuffer = StringToMultiString(path.destination); |
| 31 | info.pTo = pToBuffer.get(); |
| 32 | info.fFlags = FOF_NO_UI; |
| 33 | if (int const result = SHFileOperationW(&info); result != 0) |
| 34 | { |
| 35 | std::cerr << "Error code: " << result << " in SHFileOperationW\n"; |
| 36 | return false; |
| 37 | } |
| 38 | } |
| 39 | return true; |
| 40 | } |
| 41 | |
| 42 | std::string Win32ApiTest::GetName() const |
| 43 | { |
nothing calls this directly
no test coverage detected