allow tokens in vpaths

This commit is contained in:
tdijck 2015-03-25 09:47:33 -07:00 committed by Tom van Dijck
parent f1ff69cf8d
commit 75fcb73bf5
2 changed files with 18 additions and 7 deletions

View File

@ -939,6 +939,8 @@
name = "vpaths", name = "vpaths",
scope = "project", scope = "project",
kind = "list:keyed:list:path", kind = "list:keyed:list:path",
tokens = true,
pathVars = true,
} }
api.register { api.register {

View File

@ -743,15 +743,17 @@
premake.field.kind("directory", { premake.field.kind("directory", {
paths = true, paths = true,
store = function(field, current, value, processor) 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) value = os.matchdirs(value)
for i, file in ipairs(value) do for i, file in ipairs(value) do
value[i] = path.getabsolute(value[i]) value[i] = path.getabsolute(value[i])
end end
else
value = path.getabsolute(value)
end
return value return value
else
return path.getabsolute(value)
end
end, end,
remove = function(field, current, value, processor) remove = function(field, current, value, processor)
return path.getabsolute(value) return path.getabsolute(value)
@ -771,15 +773,17 @@
premake.field.kind("file", { premake.field.kind("file", {
paths = true, paths = true,
store = function(field, current, value, processor) 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) value = os.matchfiles(value)
for i, file in ipairs(value) do for i, file in ipairs(value) do
value[i] = path.getabsolute(value[i]) value[i] = path.getabsolute(value[i])
end end
else
value = path.getabsolute(value)
end
return value return value
else
return path.getabsolute(value)
end
end, end,
remove = function(field, current, value, processor) remove = function(field, current, value, processor)
return path.getabsolute(value) return path.getabsolute(value)
@ -968,8 +972,10 @@
paths = true, paths = true,
store = function(field, current, value, processor) store = function(field, current, value, processor)
if type(value) == "string" and value:find('/', nil, true) then if type(value) == "string" and value:find('/', nil, true) then
if string.sub(value, 1, 2) ~= "%{" then
value = path.getabsolute(value) value = path.getabsolute(value)
end end
end
return value return value
end, end,
compare = function(field, a, b, processor) compare = function(field, a, b, processor)
@ -1005,6 +1011,9 @@
premake.field.kind("path", { premake.field.kind("path", {
paths = true, paths = true,
store = function(field, current, value, processor) store = function(field, current, value, processor)
if string.sub(value, 1, 2) == "%{" then
return value
end
return path.getabsolute(value) return path.getabsolute(value)
end, end,
compare = function(field, a, b, processor) compare = function(field, a, b, processor)