Skip to content

Deleting folders from sidebar fails if files in a sub directory were open #2403

@deathaxe

Description

@deathaxe

Summary

This issue report is the result of a discussion at https://forum.sublimetext.com/t/sublimetext3-cant-delete-folders-from-side-bar-on-windows-very-often

It looks like ST locks the folder of a file it opened on Windows OS. As a result the parent folder can't be moved to the recycle bin via SHShellFileOperation which is used by the send2trash python module. Deleting the folder via Windows Explorer fails, too.

SHShellFileOperation returns error code 120.

DE_ACCESSDENIEDSRC	0x78	Security settings denied access to the source.

Expected behavior

It should be possible to remove all (parent) folders even if a file within them is still open in a view. In many other cases if a file is deleted, the view still contains the content and marks the file modified. Same should happen if one of the parent folders is deleted - no matter which level.

Actual behavior

The following screen capture shows a command prompt script creating the folders and the xml/html files within the hlp folder. If none of the files is opened in a view, the whole folder tree starting with hlp can be deleted successfully.

animation

But as soon as one of the files was open in a view - even for preview only - the folder hlp can't be deleted directly. Neither by sidebar nor by Explorer.

animation_fehler

One must delete the folder which contains the open file manually (deu in this example). In worst case this means the whole folder tree needs to be deleted by picking each folder one after another by hand - depending on the previously open files.

Steps to reproduce

  1. Create a folder tree with at least 3 levels and put some files into the deepest folder (maybe per script)
    + folder 1
       + folder 2
          + folder 3
             - file.xml
    
  2. Add folder 1 to the sidebar of ST (vanilla install)
  3. Open file.xml
  4. Close file.xml
  5. Make sure the indexer is idle
  6. Try to delete folder 2 -> fails
  7. Now delete folder 3 -> works
  8. Delete folder 2 again -> works

Environment

  • Operating system and version:
    • Windows 10 Pro 1803 x64
  • Monitor:
    • Resolution 1900x1200
    • dpi_scale used in ST 1.0
  • Sublime Text:
    • Build 3176
    • 64 bit

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions