small refactor of translateCommandsAndPaths to make it easier
to change behavor of single paths via premake.override
This commit is contained in:
parent
a3426c33a2
commit
a95e083c39
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user