Open KirillOsenkov opened 2 years ago
Let me know if you'd like a PR for this.
Here's a sample of getting the current directory for any given process: https://github.com/KirillOsenkov/Misc/blob/cf1b6ece2be91459bb301f65eac5b10e2f398562/GetProcessCurrentDirectory.cs#L16
I've learned an interesting thing today:
you can't delete a directory which is a working directory of some running process on Windows. So if you get Access Denied when trying to delete a directory, check for a running process whose current directory is it.
We should consider extending LockCheck to iterate over running processes and check if there's a process whose current directory is the one we're asking about (or a subdirectory thereof).