diff --git a/catkin_tools/context.py b/catkin_tools/context.py index 94b38c47..1044f5c3 100644 --- a/catkin_tools/context.py +++ b/catkin_tools/context.py @@ -174,12 +174,15 @@ def load( # Initialize dictionary version of opts namespace opts_vars = vars(opts) if opts else {} - # Get the workspace (either the given directory or the ws enclosing cwd) + # Get the workspace (either the given directory or the outermost ws enclosing cwd) workspace = workspace_hint or opts_vars.get('workspace', None) if not workspace: - workspaces = find_enclosing_workspaces(getcwd()) + workspace_hint = getcwd() + workspaces = find_enclosing_workspaces(workspace_hint) if workspaces: workspace = workspaces[-1] + else: + workspace = workspace_hint if not workspace: if strict or not workspace_hint: