Skip to content

Commit b9c8282

Browse files
authored
fix: Normalize the root_dir before comparison (#20)
We normalize `root_dir` before comparison. Another solution would be to avoid comparing path with `!=` or `==` and use `os.path.samefile()` But I followed the "normalization" approach the project is currently using.
1 parent c5e637b commit b9c8282

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

rustimport/importable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def __manifest_path(self) -> str:
161161
@cached_property
162162
def __workspace_path(self) -> Optional[str]:
163163
"""Returns the path of the cargo workspace this crate belongs to, if there is any."""
164-
root_dir = os.path.abspath(".").split(os.path.sep)[0] + os.path.sep
164+
root_dir = os.path.realpath(".").split(os.path.sep)[0] + os.path.sep
165165
p = self.__crate_path
166166
while os.path.dirname(p) != root_dir: # loop through all parent directories...
167167
p = os.path.dirname(p)

0 commit comments

Comments
 (0)