FileProvider icon indicating copy to clipboard operation
FileProvider copied to clipboard

Question: LocalProvider - List of copyItems

Open MasterOP22 opened this issue 7 years ago • 1 comments

Hey, i have one question and i'm not sure how to solve my problem. I have a list of files in local storage, which i want to copy to the NSTempDirectory. So far no problem. But i want to wait so long until the fileprovider copied the last item from the list to the final destination succesfully and then i want to give the new URLs back in the method return like so

func copyItemsTOTempDir(paths: [String]) -> [URL]?

So my Problem is that the function copyItem is a async function with a completionhandler or delegate, which will be called after every copy action. But how can i recognize that All paths in the list are completely copied?

MasterOP22 avatar Nov 29 '17 08:11 MasterOP22

I'm not sure why you don't use simple synchronous FileManager methods, but if an operation fails It will return error in completion handler.

Some providers like dropbox or local supports batch operations. Some like WebDAV don't. Maybe I need to define a new protocol like FileProviderBatchOperation and conform providers which support this type of operation, but I have no time just now.

amosavian avatar Dec 01 '17 09:12 amosavian