Fixed a little issue in the file system utilities. eric7

Sun, 07 Apr 2024 17:40:03 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 07 Apr 2024 17:40:03 +0200
branch
eric7
changeset 10668
2be6fadcac40
parent 10667
a82709c26b19
child 10669
456bbea5f146

Fixed a little issue in the file system utilities.

src/eric7/SystemUtilities/FileSystemUtilities.py file | annotate | diff | comparison | revisions
--- a/src/eric7/SystemUtilities/FileSystemUtilities.py	Sat Apr 06 12:50:04 2024 +0200
+++ b/src/eric7/SystemUtilities/FileSystemUtilities.py	Sun Apr 07 17:40:03 2024 +0200
@@ -122,7 +122,7 @@
     return any(os.access(os.path.join(directory, file), os.X_OK) for directory in dirs)
 
 
-def startswithPath(path, start):
+def startsWithPath(path, start):
     """
     Function to check, if a path starts with a given start path.
 
@@ -134,8 +134,9 @@
         path
     @rtype bool
     """
+    start1 = start if start.endswith(os.sep) else f"{start}{os.sep}"
     return bool(start) and (
-        path == start or normcasepath(path).startswith(normcasepath(start + "/"))
+        path == start or normcasepath(path).startswith(normcasepath(start1))
     )
 
 

eric ide

mercurial