From 8b470280735545982a32ead11c6d9f9245a65dea Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 27 Nov 2015 09:13:36 +0800 Subject: [PATCH] fix object file path bug --- xmake/scripts/base/rule.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/xmake/scripts/base/rule.lua b/xmake/scripts/base/rule.lua index b8695d41870..8e1deab7337 100644 --- a/xmake/scripts/base/rule.lua +++ b/xmake/scripts/base/rule.lua @@ -148,8 +148,22 @@ function rule.objectfiles(target_name, target, sourcefiles, buildir) -- make object file local objectfile = string.format("%s/%s/%s/%s", objectdir, target_name, path.directory(sourcefile), rule.filename(path.basename(sourcefile), "object")) + -- translate path + -- + -- .e.g + -- + -- src/xxx.c + -- project/xmake.lua + -- build/.objs + -- + -- objectfile: project/build/.objs/xxxx/../../xxx.c will be out of range for objectdir + -- + -- we need replace '..' to '__' in this case + -- + objectfile = (path.translate(objectfile):gsub("%.%.", "__")) + -- save it - objectfiles[i] = path.translate(objectfile) + objectfiles[i] = objectfile i = i + 1 end