Directory handle not released after file closed

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
seaktf
Posts: 22
Joined: Tue Mar 02, 2004 10:44 am

Directory handle not released after file closed

Post 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.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post 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.
seaktf
Posts: 22
Joined: Tue Mar 02, 2004 10:44 am

Post 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?
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post 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.
seaktf
Posts: 22
Joined: Tue Mar 02, 2004 10:44 am

Post 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".
Andrewr66
Posts: 4
Joined: Wed Sep 08, 2004 11:22 am
Location: Oslo, Norway

Please close directory handle

Post 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.
Post Reply