premake-core
premake-core copied to clipboard
forced slash replacement
prerequisites
premake5.lua
local qt_bin_path = "C:/dev/mx/v1/dep/qt/qt_33_x64_bin"
solution "myTestSln"
location "testfiles/sln"
platforms "x64"
configurations "release"
project "myTestPrj1"
kind "Utility"
files (qt_bin_path.."/bin/QtDeclarative_sofistik33_x64_4.dll")
filter "files:**/*.dll"
buildmessage ([[%{file.name} (copy)]])
buildcommands [[xcopy /y "%{file.path:gsub("/","\\")}" "bla"]]
buildoutputs ("bla")
filter "*"
Problem The resulting path can be an absolute and all "" in the path are replaced by "/". There is - afaik - no possibility to change the slashes and not all Windows tools - like xcopy - can handle paths with "/".
Cause If premake is detecting absolute paths in non path variables, they are replaced by relative paths. This is not possible all the time (not sure but here can be a bug, too). It's never possible on Windows system where files are placed over different Partitions (C:; D:).
detoken.lua:66
local isAbs = path.isabsolute(result)
if isAbs and not field.paths and basedir then
result = path.getrelative(basedir, result)
end
The path.getrelative function calls path.normalize which replaces all the "" to "/". This is not the system specification but required for further processing in premake.
path_normalize.c:30
if (ch == '\\') {
ch = '/';
}
possible Solution Allow avoiding path fixing.
detoken.lua:66
local isAbs = path.isabsolute(result)
if type(result) == "string" and result:find("!$") then
result = result:match("(.-)!$"):gsub("/","\\")
elseif isAbs and not field.paths and basedir then
result = path.getrelative(basedir, result)
end
premake5.lua (part replacement)
buildcommands [[xcopy /y "%{file.path.."!"}" "bla"]]
Or is there a way I didn't see?