small refactor of translateCommandsAndPaths to make it easier
to change behavor of single paths via premake.override
---
--- Translate decorated command paths into their OS equivalents.
+-- 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)
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
