summaryrefslogtreecommitdiff
path: root/buildstream
diff options
context:
space:
mode:
authorMartin Blanchard <martin.blanchard@codethink.co.uk>2018-07-31 12:23:48 +0100
committerMartin Blanchard <martin.blanchard@codethink.co.uk>2018-08-01 12:07:05 +0100
commit87edf67e46b0d8bc7a2d5479c129c6da1cb43a71 (patch)
treed7c40608828565de4bce487fd8855b778eb79ca8 /buildstream
parent480565c2ee6c7684c1d48cd518893ce12fc2f58d (diff)
downloadbuildstream-87edf67e46b0d8bc7a2d5479c129c6da1cb43a71.tar.gz
complete.py: Ensure paths get completed from 'element-path'mablanch/448-autocompletion-broken-defaults
Element paths should always be completed from the root element folder defined by the element-path key in project.conf. Fix complete_path() to always search into its given base_directory argument. See issue BuildStream/buildstream#448
Diffstat (limited to 'buildstream')
-rw-r--r--buildstream/_frontend/complete.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/buildstream/_frontend/complete.py b/buildstream/_frontend/complete.py
index 79bb92758..97d6d45ec 100644
--- a/buildstream/_frontend/complete.py
+++ b/buildstream/_frontend/complete.py
@@ -68,9 +68,10 @@ def complete_path(path_type, incomplete, base_directory='.'):
# If there was nothing on the left of the last separator,
# we are completing files in the filesystem root
base_path = os.path.join(base_directory, base_path)
-
- elif os.path.isdir(incomplete):
- base_path = incomplete
+ else:
+ incomplete_base_path = os.path.join(base_directory, incomplete)
+ if os.path.isdir(incomplete_base_path):
+ base_path = incomplete_base_path
try:
if base_path: