cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

713.patch (2512B)


      1# HG changeset patch
      2# User Ben Henning
      3# Date 1376606083 25200
      4#      Thu Aug 15 15:34:43 2013 -0700
      5# Node ID 8c9cd352c70012a64779356bff3c81998c3fb6a0
      6# Parent  e8558df4fbdb173a2b9ed0d354d6c3e76b376698
      7Implemented the option to set custom source trees for Xcode frameworks (links)
      8using Visual Studio-esque variables, such as "$(SDKROOT)/OpenGLES.framework".
      9
     10diff --git a/src/actions/xcode/xcode_common.lua b/src/actions/xcode/xcode_common.lua
     11--- a/src/actions/xcode/xcode_common.lua
     12+++ b/src/actions/xcode/xcode_common.lua
     13@@ -318,18 +318,36 @@
     14 					local pth, src
     15 					if xcode.isframework(node.path) then
     16 						--respect user supplied paths
     17-						if string.find(node.path,'/')  then
     18-							if string.find(node.path,'^%.')then
     19+						-- look for special variable-starting paths for different sources
     20+						local nodePath = node.path
     21+						local _, matchEnd, variable = string.find(nodePath, "^%$%((.+)%)/")
     22+						if variable then
     23+							-- by skipping the last '/' we support the same absolute/relative
     24+							-- paths as before
     25+							nodePath = string.sub(nodePath, matchEnd + 1)
     26+						end
     27+						if string.find(nodePath,'/')  then
     28+							if string.find(nodePath,'^%.')then
     29 								error('relative paths are not currently supported for frameworks')
     30 							end
     31-							pth = node.path
     32+							pth = nodePath
     33 						else
     34-							pth = "/System/Library/Frameworks/" .. node.path
     35+							pth = "/System/Library/Frameworks/" .. nodePath
     36 						end
     37-						src = "absolute"
     38+						-- if it starts with a variable, use that as the src instead
     39+						if variable then
     40+							src = variable
     41+							-- if we are using a different source tree, it has to be relative
     42+							-- to that source tree, so get rid of any leading '/'
     43+							if string.find(pth, '^/') then
     44+								pth = string.sub(pth, 2)
     45+							end
     46+						else
     47+							src = "<absolute>"
     48+						end
     49 					else
     50 						-- something else; probably a source code file
     51-						src = "group"
     52+						src = "<group>"
     53 
     54 						-- if the parent node is virtual, it won't have a local path
     55 						-- of its own; need to use full relative path from project
     56@@ -340,7 +358,7 @@
     57 						end
     58 					end
     59 					
     60-					_p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = "%s"; path = "%s"; sourceTree = "<%s>"; };',
     61+					_p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = "%s"; path = "%s"; sourceTree = "%s"; };',
     62 						node.id, node.name, xcode.getfiletype(node), node.name, pth, src)
     63 				end
     64 			end