| 850 | } |
| 851 | |
| 852 | SC::Result SC::AsyncFileSystemOperation::removeFile(AsyncEventLoop& eventLoop, StringSpan path) |
| 853 | { |
| 854 | SC_TRY(checkState()); |
| 855 | operation = Operation::RemoveFile; |
| 856 | new (&removeData, PlacementNew()) RemoveData({path}); |
| 857 | if (not eventLoop.needsThreadPoolForFileOperations() and threadPoolMode != AsyncThreadPoolMode::ForceThreadPool) |
| 858 | { |
| 859 | return eventLoop.start(*this); |
| 860 | } |
| 861 | |
| 862 | loopWork.work = [&]() |
| 863 | { |
| 864 | SC_TRY(FileSystem::Operations::removeFile(removeData.path)); |
| 865 | return SC::Result(true); |
| 866 | }; |
| 867 | loopWork.callback.bind<AsyncFileSystemOperation, &AsyncFileSystemOperation::onOperationCompleted>(*this); |
| 868 | return eventLoop.start(loopWork); |
| 869 | } |
| 870 | |
| 871 | SC::Result SC::AsyncFileSystemOperation::copyDirectory(AsyncEventLoop& eventLoop, StringSpan path, |
| 872 | StringSpan destinationPath, FileSystemCopyFlags copyFlags) |