From cf4d189368e633127a6df21a383491afdae2e02a Mon Sep 17 00:00:00 2001 From: Tom van Dijck Date: Mon, 8 Jun 2015 11:48:02 -0700 Subject: [PATCH] adding table.filterempty to vstudio.path --- src/actions/vstudio/_vstudio.lua | 8 +++++++- src/actions/vstudio/vs2010_vcxproj.lua | 15 ++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/actions/vstudio/_vstudio.lua b/src/actions/vstudio/_vstudio.lua index 52995dc0..c536b770 100644 --- a/src/actions/vstudio/_vstudio.lua +++ b/src/actions/vstudio/_vstudio.lua @@ -397,7 +397,13 @@ function vstudio.path(cfg, value) 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 diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua index 1622c6fa..c13e8623 100644 --- a/src/actions/vstudio/vs2010_vcxproj.lua +++ b/src/actions/vstudio/vs2010_vcxproj.lua @@ -903,8 +903,7 @@ function m.additionalIncludeDirectories(cfg, includedirs) if #includedirs > 0 then - local dirs = vstudio.path(cfg.project, includedirs) - dirs = table.filterempty(dirs) + local dirs = vstudio.path(cfg, includedirs) if #dirs > 0 then p.x('%s;%%(AdditionalIncludeDirectories)', table.concat(dirs, ";")) end @@ -1129,11 +1128,15 @@ function m.forceIncludes(cfg, condition) if #cfg.forceincludes > 0 then 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 if #cfg.forceusings > 0 then 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 @@ -1432,9 +1435,7 @@ function m.executablePath(cfg) - local dirs = project.getrelative(cfg.project, cfg.bindirs) - dirs = table.filterempty(dirs) - + local dirs = vstudio.path(cfg, cfg.bindirs) if #dirs > 0 then _x(2,'%s;$(ExecutablePath)', path.translate(table.concat(dirs, ";"))) end