Skip to content

Commit 6443bbd

Browse files
committed
Import send2trash and run command directly if delete_file not available
1 parent 4038769 commit 6443bbd

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

advanced_new_file/commands/delete_file_command.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,16 @@ def _delete_file(self, filepath):
6161
if vcs_tracking:
6262
self._git_rm(filepath)
6363
else:
64-
command = self._delete_file_command()
65-
self.window.run_command(command, {"files": [filepath]})
64+
self._execute_delete_file(filepath)
6665

6766
self.refresh_sidebar()
6867

69-
def _delete_file_command(self):
68+
def _execute_delete_file(self, filepath):
7069
if IS_ST3 and self._side_bar_enhancements_installed():
71-
return "side_bar_delete"
72-
return "delete_file"
70+
import Default.send2trash as send2trash
71+
send2trash.send2trash(filepath)
72+
else:
73+
self.window.run_command("delete_file", {"files": [filepath]})
7374

7475
def _side_bar_enhancements_installed(self):
7576
return "SideBarEnhancements.SideBar" in sys.modules

0 commit comments

Comments
 (0)