From 7849eaf80f2c99bba3f69f952baf9713bade28d6 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 28 Sep 2016 17:51:26 +0200 Subject: [PATCH] Build: Fix package on Linux/OS X Former-commit-id: af859279daff0a3277885a129dbe0a3b64b670ee [formerly 9b5c746de0092b15a3a6b22e7b62c0d786511f74] [formerly c0deb3f2282e65eced2a847bfe96fade40000e0d [formerly 778655003cf7af0d129e08cf1241c0e7062cbc02]] Former-commit-id: 1c43974f748ac73fb001ed826e33e6d65fa6be5a [formerly 860aaa09c8659b40712ecfbde1503098cb18d26f] Former-commit-id: e13892bcca0dac59917554a6236ff53015c7cb2c --- build/scripts/actions/package.lua | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/build/scripts/actions/package.lua b/build/scripts/actions/package.lua index b62ca3643..8a08b3125 100644 --- a/build/scripts/actions/package.lua +++ b/build/scripts/actions/package.lua @@ -124,7 +124,7 @@ ACTION.Function = function () -- Demo executable (OS X) table.insert(copyTargets, { Masks = {"Demo*"}, - Filter = function (path) return path.getextension(path) == "" end, + Filter = function (filePath) return path.getextension(filePath) == "" end, Source = "../examples/bin/", Target = "examples/bin/" }) @@ -132,7 +132,7 @@ ACTION.Function = function () -- Unit test (OS X) table.insert(copyTargets, { Masks = {"*.*"}, - Filter = function (path) return path.getextension(path) == "" end, + Filter = function (filePath) return path.getextension(filePath) == "" end, Source = "../tests/", Target = "tests/" }) @@ -162,7 +162,7 @@ ACTION.Function = function () -- Demo executable (Linux) table.insert(copyTargets, { Masks = {"Demo*"}, - Filter = function (path) return path.getextension(path) == "" end, + Filter = function (filePath) return path.getextension(filePath) == "" end, Source = "../examples/bin/", Target = "examples/bin/" }) @@ -170,7 +170,7 @@ ACTION.Function = function () -- Unit test (Linux) table.insert(copyTargets, { Masks = {"*.*"}, - Filter = function (path) return path.getextension(path) == "" end, + Filter = function (filePath) return path.getextension(filePath) == "" end, Source = "../tests/", Target = "tests/" }) @@ -191,7 +191,7 @@ ACTION.Function = function () local files = os.matchfiles(includePrefix .. mask) if (v.Filter) then for k,path in pairs(files) do - if (not v.Filter(v)) then + if (not v.Filter(path)) then files[k] = nil end end @@ -213,7 +213,14 @@ ACTION.Function = function () end end - local ok, err = os.copyfile(v, targetPath) + local ok, err + if (os.is("windows")) then + ok, err = os.copyfile(v, targetPath) + else + -- Workaround: As premake is translating this to "cp %s %s", it fails if there are space in the paths. + ok, err = os.copyfile(string.format("\"%s\"", v), string.format("\"%s\"", targetPath)) + end + if (not ok) then print("Failed to copy \"" .. v .. "\" to \"" .. targetPath .. "\": " .. err) end