Page 1 of 1
Directory handle not released after file closed
Posted: Mon Aug 22, 2005 12:43 pm
by seaktf
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.
Posted: Mon Aug 22, 2005 1:16 pm
by ben_josephs
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.
Posted: Mon Aug 22, 2005 1:24 pm
by seaktf
Oh I see
So it's really a bug. Because it doesn't make sense to hold on a "working folder" when there's no more
active document.
Does it hurt to disable such option? I mean, what's this working folder supposed for?
Posted: Mon Aug 22, 2005 2:22 pm
by ben_josephs
The option is useful if you have files from several directories open in a single session; it gives you a quick way to get the Open dialogue to open in a particular directory.
I agree that it's irritating that TextPad holds onto the directory handle. I don't know why it does that.
Posted: Mon Aug 22, 2005 3:02 pm
by seaktf
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".
Please close directory handle
Posted: Thu Sep 22, 2005 10:40 am
by Andrewr66
I agree with "seaktf".
- 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."
I still want to use "Working folder follows active document".
AndR.