rizonesoft / Notepad3

Notepad like text editor based on the Scintilla source code. Notepad3 based on code from Notepad2 and MiniPath on code from metapath. Download Notepad3:
https://www.rizonesoft.com/downloads/notepad3/
Other
5.09k stars 335 forks source link

Notepad3 locks the file directory and cannot delete the directory #4080

Closed nil-ref closed 2 years ago

nil-ref commented 2 years ago

When I open a txt file in a directory. I cannot delete the directory.

In Notepad3.c(v5.21.1129.1) 10675 line:

// change current directory to prevent directory lock on another path
HPATHL hdir_pth = Path_Copy(hopen_file);
Path_RemoveFileSpec(hdir_pth);
if (Path_IsExistingDirectory(hdir_pth)) {
    SetCurrentDirectoryW(Path_Get(hdir_pth));
}
Path_Release(hdir_pth);

The SetCurrentDirectoryW API Locked the file directory.

nil-ref commented 2 years ago

I mean is that sometimes I open a lot of txt files. At this point I need to delete some folders, and often encounter a prompt that cannot be deleted. I have to close all open notepads. There is no problem in official notepad.

nil-ref commented 2 years ago

I think the SetCurrentDirectoryW call here should be removed.

hpwamr commented 2 years ago

Hello, I confirm: I've tested to delete the parent directory with 15 text editors (configuration: Out-of-the-Box):

hpwamr commented 2 years ago

I think the SetCurrentDirectoryW call here should be removed.

Hello @RaiKoHoff , In Notepad3.c, SetCurrentDirectoryW is present in 2 places: line_1062 and line_10679. For test purpose, I've commented from line_10676 till line_10681. Result: It seems to fix this issue... 🤔

hpwamr commented 2 years ago

Hello @nil-ref ,

Feel free to test the "BETA/RC PortableApps", version "Notepad3Portable_5.22.829.1_beta.paf" or newer, see 1st list in issue #1129.

"Notepad3Portable BETA/RC PortableApps" version can be used with or without ".7z" extension.

Also, feel free to test the "BETA/RC Setup", version "Notepad3_5.22.829.1_beta_Setup" or newer, see the 2nd list in issue #1129.

Comments and suggestions are welcome... 😃