TDirectory.Delete seems to be asynchronous

半世苍凉 提交于 2019-12-05 19:17:47

Take a look the msdn page about RemoveDirectory: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365488(v=vs.85).aspx

The Remarks section says:

The RemoveDirectory function marks a directory for deletion on close. Therefore, the directory is not removed until the last handle to the directory is closed.

So probably another process also has a handle to the directory (virus scanner?).

If you need to empty the directory, then empty it instead of deleting it and recreating it afterwards. In the end you always pay for a dirty hack ;)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!