small refactor of translateCommandsAndPaths to make it easier

to change behavor of single paths via premake.override
This commit is contained in:
R. Blaine Whittle 2017-09-22 09:57:41 -07:00 committed by Tom van Dijck
parent a3426c33a2
commit a95e083c39

View File

@ -658,10 +658,19 @@
---
-- Apply os slashes for decorated command paths.
---
function os.translateCommandAndPath(path, map)
if map == 'windows' then
return path.translate(result)
end
return path
end
---
-- Translate decorated command paths into their OS equivalents.
---
function os.translateCommandsAndPaths(cmds, basedir, location, map)
local translatedBaseDir = path.getrelative(location, basedir)
@ -669,13 +678,11 @@
local translateFunction = function(value)
local result = path.join(translatedBaseDir, value)
if value:endswith('/') or value:endswith('\\') or
result = os.translateCommandAndPath(result, map)
if value:endswith('/') or value:endswith('\\') or -- if orginal path ends with a slash then ensure the same
value:endswith('/"') or value:endswith('\\"') then
result = result .. '/'
end
if map == 'windows' then
result = path.translate(result)
end
return result
end