Suppose a file, X:\dir1\dir2\...\dirN\file.txt, is opened in TextPad. Even if the file is closed within TextPad, the whole path, ie X:\dir1\dir2\...\dirN\, is still open. This is checked against using Process Explorer and it's clear that the handle to that directory isn't released.
In some situation this is quite annoying. For example, sometimes I'd like to create a temporary directory to contain a few files, open them, try what I wanted and delete the whole directory. But since the directory handle isn't released, I can't delete the temp directory. The only way is to close TextPad. Well actually, with Process Explorer it's possible to force a handle closing but this is not recommended.
Directory handle not released after file closed
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
You have Configure | Preferences | General | Working folder follows active document selected. If, after closing the file in the temporary directory, there are no documents open, TextPad holds onto that directory as there isn't another active document for it to follow. Either deselect that option or just open a file in another directory.
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
OK, I see what it's used for.
There's a workaround (hope the developer is reading the forum):
instead of keeping the handle to directory, TextPad could hold the string of the path of working directory, ie "X:\dir1\dir2\...\dirN\".
So when a user click the open button, Textpad checks if this directory exists. If it doesn't, TP climbs up one level, ie "X:\dir1\dir2\...\dirN-1\", and check the existence, and so on and so on until a directory exists. If even X: doesn't exist (eg removable media like CD-Rom or USB memory is not present), then TP could use a default working directory like "My Documents" or "Desktop".
There's a workaround (hope the developer is reading the forum):
instead of keeping the handle to directory, TextPad could hold the string of the path of working directory, ie "X:\dir1\dir2\...\dirN\".
So when a user click the open button, Textpad checks if this directory exists. If it doesn't, TP climbs up one level, ie "X:\dir1\dir2\...\dirN-1\", and check the existence, and so on and so on until a directory exists. If even X: doesn't exist (eg removable media like CD-Rom or USB memory is not present), then TP could use a default working directory like "My Documents" or "Desktop".
Please close directory handle
I agree with "seaktf".
AndR.
- Find directory in explorer
Can I delete this directory?
Check some files, maybe readme.txt (with Textpad)
Yes, it's OK to delete directory,
Close file in Textpad
Try to delete directory
NO, error message. "Cannot delete directory: It is being used by another person or program."
AndR.