Incorrect warning when deleting dir
Moderators: Hacker, petermad, Stefan2, white
Incorrect warning when deleting dir
There is an incorrect warning sometimes - steps to reproduce (tested with Win2k and WinXP):
1) enable config option: Operation/Refresh -> Refresh when files are created, deleted and renamed (WatchDirs=1 or any odd)
2) create empty dir c:\test
3) enter into c:\test
4) open second instance of TCMD
5) using second instance, try to delete c:\test
6) c:\test is being deleted now (we can see this in case of switching to the first instance of TCMD)
7) warning appears (but shouldn't): "The directory c:\test is not empty! Do you want to delete it with all its files and subdirectories?"
8) there is no difference what button we press in this dialog, because directory has already been deleted
1) enable config option: Operation/Refresh -> Refresh when files are created, deleted and renamed (WatchDirs=1 or any odd)
2) create empty dir c:\test
3) enter into c:\test
4) open second instance of TCMD
5) using second instance, try to delete c:\test
6) c:\test is being deleted now (we can see this in case of switching to the first instance of TCMD)
7) warning appears (but shouldn't): "The directory c:\test is not empty! Do you want to delete it with all its files and subdirectories?"
8) there is no difference what button we press in this dialog, because directory has already been deleted
- ghisler(Author)
- Site Admin
- Posts: 50861
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Yes, you get this also when the directory is the current directory in some other program. TC has no possibility to distinguish these two cases, sorry.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
I've checked (with a debugger), that TCMD calls RemoveDirectoryA/W, which returns True (that means, that the directory has been deleted). So before displaying message "The directory c:\test is not empty!", you can probably easily check if the directory still exists (e.g. by using DirectoryExists Delphi function). If not - there is no need to display any dialog. Regards!
- ghisler(Author)
- Site Admin
- Posts: 50861
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Strange, does the directory disappear when you close the other program then?TCMD calls RemoveDirectoryA/W, which returns True
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
There is a difference between TCMD and other programs:
a) when my test program sets its current directory to C:\TEST (which is empty),
TCMD can't delete this directory - we get two warnings:
"The directory C:\TEST is not empty!" and then:
"The directory C:\TEST could not be deleted!" (and directory C:\TEST still exists)
b) when TCMD enters into C:\TEST (which is empty), another instance of
TCMD __can__ delete this directory - RemoveDirectoryA/W returns True
and then we get only one warning:
"The directory C:\TEST is not empty!" (but directory is already deleted)
So - because we can delete C:\TEST - TCMD probably doesn't set its current
directory to C:\TEST when we get into C:\TEST. So there must be some strange
reason for displaying "The directory C:\TEST is not empty!" __after__ deleting it.
a) when my test program sets its current directory to C:\TEST (which is empty),
TCMD can't delete this directory - we get two warnings:
"The directory C:\TEST is not empty!" and then:
"The directory C:\TEST could not be deleted!" (and directory C:\TEST still exists)
b) when TCMD enters into C:\TEST (which is empty), another instance of
TCMD __can__ delete this directory - RemoveDirectoryA/W returns True
and then we get only one warning:
"The directory C:\TEST is not empty!" (but directory is already deleted)
So - because we can delete C:\TEST - TCMD probably doesn't set its current
directory to C:\TEST when we get into C:\TEST. So there must be some strange
reason for displaying "The directory C:\TEST is not empty!" __after__ deleting it.
- ghisler(Author)
- Site Admin
- Posts: 50861
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Sorry, I will keep it as it is now, at least for the moment.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com