From 75fcb73bf5d8c1aa750b5f638c536371688b338c Mon Sep 17 00:00:00 2001 From: tdijck Date: Wed, 25 Mar 2015 09:47:33 -0700 Subject: [PATCH] allow tokens in vpaths --- src/_premake_init.lua | 2 ++ src/base/api.lua | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/_premake_init.lua b/src/_premake_init.lua index 00de0740..10e81a26 100644 --- a/src/_premake_init.lua +++ b/src/_premake_init.lua @@ -939,6 +939,8 @@ name = "vpaths", scope = "project", kind = "list:keyed:list:path", + tokens = true, + pathVars = true, } api.register { diff --git a/src/base/api.lua b/src/base/api.lua index 3e4a846f..ebe0efd9 100755 --- a/src/base/api.lua +++ b/src/base/api.lua @@ -743,15 +743,17 @@ premake.field.kind("directory", { paths = true, store = function(field, current, value, processor) - if value:find("*") then + if string.sub(value, 1, 2) == "%{" then + return value + elseif value:find("*") then value = os.matchdirs(value) for i, file in ipairs(value) do value[i] = path.getabsolute(value[i]) end + return value else - value = path.getabsolute(value) + return path.getabsolute(value) end - return value end, remove = function(field, current, value, processor) return path.getabsolute(value) @@ -771,15 +773,17 @@ premake.field.kind("file", { paths = true, store = function(field, current, value, processor) - if value:find("*") then + if string.sub(value, 1, 2) == "%{" then + return value + elseif value:find("*") then value = os.matchfiles(value) for i, file in ipairs(value) do value[i] = path.getabsolute(value[i]) end + return value else - value = path.getabsolute(value) + return path.getabsolute(value) end - return value end, remove = function(field, current, value, processor) return path.getabsolute(value) @@ -968,7 +972,9 @@ paths = true, store = function(field, current, value, processor) if type(value) == "string" and value:find('/', nil, true) then - value = path.getabsolute(value) + if string.sub(value, 1, 2) ~= "%{" then + value = path.getabsolute(value) + end end return value end, @@ -1005,6 +1011,9 @@ premake.field.kind("path", { paths = true, store = function(field, current, value, processor) + if string.sub(value, 1, 2) == "%{" then + return value + end return path.getabsolute(value) end, compare = function(field, a, b, processor)