aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.py4
-rw-r--r--interpreter.py6
-rw-r--r--test cases/failing/6 missing incdir/meson.build3
3 files changed, 10 insertions, 3 deletions
diff --git a/build.py b/build.py
index bedff9e..57fc9ce 100644
--- a/build.py
+++ b/build.py
@@ -86,8 +86,8 @@ class IncludeDirs():
def __init__(self, curdir, dirs, kwargs):
self.curdir = curdir
self.incdirs = dirs
- # Fixme: check that the directories actually exist.
- # Also that they don't contain ".." or somesuch.
+ # Interpreter has validated that all given directories
+ # actually exist.
if len(kwargs) > 0:
raise InvalidArguments('Includedirs function does not take keyword arguments.')
diff --git a/interpreter.py b/interpreter.py
index 402a185..bc5b3ab 100644
--- a/interpreter.py
+++ b/interpreter.py
@@ -1001,10 +1001,14 @@ class Interpreter():
conf.mark_used()
def func_include_directories(self, node, args, kwargs):
+ curdir = os.path.join(self.subproject, self.subdir)
+ absbase = os.path.join(self.environment.get_source_dir(), curdir)
for a in args:
if not isinstance(a, str):
raise InvalidArguments('Argument %s is not a string.' % str(a))
- curdir = os.path.join(self.subproject, self.subdir)
+ absdir = os.path.join(absbase, a)
+ if not os.path.isdir(absdir):
+ raise InvalidArguments('Include dir %s does not exist.' % a)
i = IncludeDirsHolder(curdir, args, kwargs)
return i
diff --git a/test cases/failing/6 missing incdir/meson.build b/test cases/failing/6 missing incdir/meson.build
new file mode 100644
index 0000000..617ee77
--- /dev/null
+++ b/test cases/failing/6 missing incdir/meson.build
@@ -0,0 +1,3 @@
+project('missing incdir', 'c')
+
+inc = include_directories('nosuchdir')