Skip to content

Commit 7501e53

Browse files
committed
Use logical working directory, not resolving symlinks
When running from a symlinked subfolder, os.getcwd() and Path.cwd() return the real path with all all symlinks resolved. This resulted in the workspace root to be found w.r.t. the real path instead the actual logical one.
1 parent 0d6fe67 commit 7501e53

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: colcon_top_level_workspace/argument_parser.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ def is_root(path):
8484
return True
8585
return all([(path / folder).is_dir() for folder in ["log", "build", "install"]])
8686

87-
path = Path.cwd()
87+
# get logical working directory (with symlinks not resolved)
88+
path = os.environ.get("PWD")
89+
90+
path = Path(path) if path is not None else Path.cwd()
8891
_root_path = path
8992
anchor = Path(path.anchor)
9093
while True:

0 commit comments

Comments
 (0)