120 |
120 |
121 dirs = path.split(os.pathsep) |
121 dirs = path.split(os.pathsep) |
122 return any(os.access(os.path.join(directory, file), os.X_OK) for directory in dirs) |
122 return any(os.access(os.path.join(directory, file), os.X_OK) for directory in dirs) |
123 |
123 |
124 |
124 |
125 def startswithPath(path, start): |
125 def startsWithPath(path, start): |
126 """ |
126 """ |
127 Function to check, if a path starts with a given start path. |
127 Function to check, if a path starts with a given start path. |
128 |
128 |
129 @param path path to be checked |
129 @param path path to be checked |
130 @type str |
130 @type str |
132 @type str |
132 @type str |
133 @return flag indicating that the path starts with the given start |
133 @return flag indicating that the path starts with the given start |
134 path |
134 path |
135 @rtype bool |
135 @rtype bool |
136 """ |
136 """ |
|
137 start1 = start if start.endswith(os.sep) else f"{start}{os.sep}" |
137 return bool(start) and ( |
138 return bool(start) and ( |
138 path == start or normcasepath(path).startswith(normcasepath(start + "/")) |
139 path == start or normcasepath(path).startswith(normcasepath(start1)) |
139 ) |
140 ) |
140 |
141 |
141 |
142 |
142 def relativeUniversalPath(path, start): |
143 def relativeUniversalPath(path, start): |
143 """ |
144 """ |