From bb18026fccd69d85196a7404b314d1a104be9c1d Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Thu, 29 Aug 2013 12:21:32 -0400 Subject: [PATCH] Added fileconfig.hasFileSettings() call to check if any per-file values are actually present in the config --- src/project/fileconfig.lua | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/project/fileconfig.lua b/src/project/fileconfig.lua index 35d759ef..2d5f3220 100644 --- a/src/project/fileconfig.lua +++ b/src/project/fileconfig.lua @@ -156,6 +156,37 @@ +-- +-- Checks to see if the file configuration contains any unique information, +-- or if it is the same as its parent configuration. +-- +-- @param fcfg +-- A file configuration. +-- @return +-- True if the file configuration contains values which differ from the +-- parent project configuration, false otherwise. +-- + + function fileconfig.hasFileSettings(fcfg) + for key, field in pairs(premake.fields) do + if field.scope == "config" then + local value = fcfg[field.name] + if value then + if type(value) == "table" then + if #value > 0 then + return true + end + else + return true + end + end + end + end + return false + end + + + -- -- Rather than store pre-computed strings for all of the path variations -- (abspath, relpath, vpath, name, etc.) for each file (there can be quite