src/eric7/Project/ProjectOthersBrowser.py

branch
eric7
changeset 10256
1b728f26d1ae
parent 10113
40eb9038d100
child 10398
ef1ea18994d5
--- a/src/eric7/Project/ProjectOthersBrowser.py	Tue Oct 24 11:45:39 2023 +0200
+++ b/src/eric7/Project/ProjectOthersBrowser.py	Wed Oct 25 14:30:33 2023 +0200
@@ -9,7 +9,6 @@
 """
 
 import contextlib
-import os
 
 from PyQt6.QtCore import QModelIndex, QUrl, pyqtSignal
 from PyQt6.QtGui import QDesktopServices
@@ -445,31 +444,13 @@
         """
         Private method to add files to the project.
         """
-        itm = self.model().item(self.currentIndex())
-        if isinstance(itm, ProjectBrowserFileItem):
-            dn = os.path.dirname(itm.fileName())
-        elif isinstance(
-            itm, (ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem)
-        ):
-            dn = itm.dirName()
-        else:
-            dn = None
-        self.project.addFiles("OTHERS", dn)
+        self.project.addFiles("OTHERS", self.currentDirectory())
 
     def __addOthersDirectory(self):
         """
         Private method to add files of a directory to the project.
         """
-        itm = self.model().item(self.currentIndex())
-        if isinstance(ProjectBrowserFileItem):
-            dn = os.path.dirname(itm.fileName())
-        elif isinstance(
-            itm, (ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem)
-        ):
-            dn = itm.dirName()
-        else:
-            dn = None
-        self.project.addDirectory("OTHERS", dn)
+        self.project.addDirectory("OTHERS", self.currentDirectory())
 
     def __removeItem(self):
         """

eric ide

mercurial