Skip to content

Commit

Permalink
Merge pull request #8 from Intermodalics/fix/undefined-workspace-vari…
Browse files Browse the repository at this point in the history
…able-2

Fix implicit creation of a new context if none exist yet
  • Loading branch information
meyerj authored Mar 4, 2021
2 parents b5bacbf + 53a2363 commit d6bc67c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions catkin_tools/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d6bc67c

Please sign in to comment.