diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2013-01-11 17:55:03 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2013-01-11 17:59:41 +0100 |
commit | 86948b9b08000540129787331b951a9018bf734c (patch) | |
tree | 4818b5d3fa1be9aa8a8fbde7cbbb39a782b0aec2 /tools/wixl/preprocessor.vala | |
parent | cb3b38e43c936664e3744fdfa7a846d4b52bd588 (diff) | |
download | msitools-86948b9b08000540129787331b951a9018bf734c.tar.gz msitools-86948b9b08000540129787331b951a9018bf734c.tar.xz msitools-86948b9b08000540129787331b951a9018bf734c.zip |
wixl: add --includedir to add directory to search for included files
Diffstat (limited to 'tools/wixl/preprocessor.vala')
-rw-r--r-- | tools/wixl/preprocessor.vala | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/tools/wixl/preprocessor.vala b/tools/wixl/preprocessor.vala index 2d87b21..d53f341 100644 --- a/tools/wixl/preprocessor.vala +++ b/tools/wixl/preprocessor.vala @@ -2,14 +2,16 @@ namespace Wixl { class Preprocessor: Object { + unowned List<File> includedirs; HashTable<string, string> globals; HashTable<string, string> variables; construct { variables = new HashTable<string, string> (str_hash, str_equal); } - public Preprocessor (HashTable<string, string> globals) { + public Preprocessor (HashTable<string, string> globals, List<File> includedirs) { this.globals = globals; + this.includedirs = includedirs; } public void define_variable (string name, string value) { @@ -114,11 +116,21 @@ namespace Wixl { break; case "include": var value = eval (reader.const_value (), file).strip (); - foreach (var inc in new string[] { - value, - file.get_parent ().get_child (value).get_path () }) - if (include (inc, writer)) + var success = false; + string[] dirs = {}; + dirs += value; + dirs += file.get_parent ().get_child (value).get_path (); + foreach (var dir in includedirs) + dirs += dir.get_child (value).get_path (); + foreach (var inc in dirs) { + success = include (inc, writer); + if (success) break; + } + if (!success) { + print ("error", loc, "Failed to include %s".printf (value)); + Posix.exit (1); + } break; case "warning": print ("warning", loc, eval (reader.const_value (), file)); |