diff files.c @ 112:2b0b61fd1a36

Fix handling of relative includes.
author David A. Holland
date Tue, 11 Jun 2013 13:50:07 -0400
parents 33954a07d013
children 1e7144176a42
line wrap: on
line diff
--- a/files.c	Tue Jun 11 13:11:01 2013 -0400
+++ b/files.c	Tue Jun 11 13:50:07 2013 -0400
@@ -290,12 +290,16 @@
 
 static
 char *
-mkfilename(const char *dir, const char *file)
+mkfilename(struct place *place, const char *dir, const char *file)
 {
 	size_t dlen, flen, rlen;
 	char *ret;
 	bool needslash = false;
 
+	if (dir == NULL) {
+		dir = place_getparsedir(place);
+	}
+
 	dlen = strlen(dir);
 	flen = strlen(file);
 	if (dlen > 0 && dir[dlen-1] != '/') {
@@ -352,7 +356,7 @@
 		num = incdirarray_num(path);
 		for (i=0; i<num; i++) {
 			id = incdirarray_get(path, i);
-			file = mkfilename(id->name, name);
+			file = mkfilename(place, id->name, name);
 			fd = file_tryopen(file);
 			if (fd >= 0) {
 				pf = place_addfile(place, file, id->issystem);