0

I write Files on a USB Drive and sometimes i have a bug where the popup of end of files transfert is displayed before the export is successful, therefore the user unplug the key too soon.

So have you a solution to check if the usb drive is in use or is safe for remove?

Thanks

I try to understand why the pop-up is showing to soon but I find no reason. For the moment my solution is to try to Open the last copied file with file.open() and try catch but I'm not satisfied of this solution.

alexisL
  • 1
  • 1
  • 1
    Presumably you're doing the copying yourself in your app? Something like this might help: [How to ensure all data has been physically written to disk?](https://stackoverflow.com/q/383324/69809). Apart from educating the users not to do this. :) – vgru Jan 31 '23 at 16:05
  • _"Apart from educating the users not to do this."_ - But the software apparently is showing a Popup that sais it is safe to do so. @vgru – Fildor Jan 31 '23 at 16:06
  • Does this answer your question? [MainWindow.CreateFile always returns -1](https://stackoverflow.com/questions/39154020/mainwindow-createfile-always-returns-1) – Peter B Jan 31 '23 at 16:09
  • @Fildor what I meant was, if I am copying data to an external drive, I will always tell Windows to safely remove it before unplugging it, because that's the only way you're going to be certain everything is flushed – vgru Jan 31 '23 at 16:22
  • Can you post the logic where you are copying the file? Also what does the Popup say, is it your custom popup or popup from Windows/Framework? – Lokanath Jan 31 '23 at 16:24
  • 2
    @vgru Right. So the solution would be to not show that popup from the App _at all_. Right? – Fildor Jan 31 '23 at 16:26
  • @vgru the user don't have access to windows to safely remove. – alexisL Feb 06 '23 at 14:09

0 Answers0