adding table.filterempty to vstudio.path

This commit is contained in:
Tom van Dijck 2015-06-08 11:48:02 -07:00
parent 65a69d6546
commit cf4d189368
2 changed files with 15 additions and 8 deletions

View File

@ -397,7 +397,13 @@
function vstudio.path(cfg, value) function vstudio.path(cfg, value)
cfg = cfg.project or cfg cfg = cfg.project or cfg
return path.translate(project.getrelative(cfg, value)) local dirs = path.translate(project.getrelative(cfg, value))
if type(dirs) == 'table' then
dirs = table.filterempty(dirs)
end
return dirs
end end

View File

@ -903,8 +903,7 @@
function m.additionalIncludeDirectories(cfg, includedirs) function m.additionalIncludeDirectories(cfg, includedirs)
if #includedirs > 0 then if #includedirs > 0 then
local dirs = vstudio.path(cfg.project, includedirs) local dirs = vstudio.path(cfg, includedirs)
dirs = table.filterempty(dirs)
if #dirs > 0 then if #dirs > 0 then
p.x('<AdditionalIncludeDirectories>%s;%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>', table.concat(dirs, ";")) p.x('<AdditionalIncludeDirectories>%s;%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>', table.concat(dirs, ";"))
end end
@ -1129,11 +1128,15 @@
function m.forceIncludes(cfg, condition) function m.forceIncludes(cfg, condition)
if #cfg.forceincludes > 0 then if #cfg.forceincludes > 0 then
local includes = vstudio.path(cfg, cfg.forceincludes) local includes = vstudio.path(cfg, cfg.forceincludes)
m.element("ForcedIncludeFiles", condition, table.concat(includes, ';')) if #includes > 0 then
m.element("ForcedIncludeFiles", condition, table.concat(includes, ';'))
end
end end
if #cfg.forceusings > 0 then if #cfg.forceusings > 0 then
local usings = vstudio.path(cfg, cfg.forceusings) local usings = vstudio.path(cfg, cfg.forceusings)
m.element("ForcedUsingFiles", condition, table.concat(usings, ';')) if #usings > 0 then
m.element("ForcedUsingFiles", condition, table.concat(usings, ';'))
end
end end
end end
@ -1432,9 +1435,7 @@
function m.executablePath(cfg) function m.executablePath(cfg)
local dirs = project.getrelative(cfg.project, cfg.bindirs) local dirs = vstudio.path(cfg, cfg.bindirs)
dirs = table.filterempty(dirs)
if #dirs > 0 then if #dirs > 0 then
_x(2,'<ExecutablePath>%s;$(ExecutablePath)</ExecutablePath>', path.translate(table.concat(dirs, ";"))) _x(2,'<ExecutablePath>%s;$(ExecutablePath)</ExecutablePath>', path.translate(table.concat(dirs, ";")))
end end