Jason Perkins avatar Jason Perkins committed 84f69f7

Fixed Xcode3 bug with sources in a subdirectory and grouped in virtual path

Comments (0)

Files changed (3)

src/actions/xcode/xcode_common.lua

 						src = "absolute"
 					else
 						-- something else; probably a source code file
-						pth = tree.getlocalpath(node)
 						src = "group"
+
+						-- if the parent node is virtual, it won't have a local path
+						-- of its own; need to use full relative path from project
+						if node.parent.isvpath then
+							pth = node.cfg.name
+						else
+							pth = tree.getlocalpath(node)
+						end
 					end
 					
 					_p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = "%s"; path = "%s"; sourceTree = "<%s>"; };',

tests/actions/vstudio/vc200x/test_filters.lua

 		</Filter>
 		]]
 	end
-
-
--- TODO: should be NO filter, with uuid
---       can I tell if this is a virtual folder by munging the path?
---       can I build that feature into the source tree?

tests/actions/xcode/test_xcode_project.lua

 		]]
 	end
 
+
 	function suite.PBXFileReference_ListsXibCorrectly()
 		files { "English.lproj/MainMenu.xib", "French.lproj/MainMenu.xib" }
 		prepare()
 	end
 	
 	
-	function suite.PBXFileReference_leavesFrameWorkLocationsAsIsWhenSupplied_pathIsSetToInput()
+	function suite.PBXFileReference_leavesFrameworkLocationsAsIsWhenSupplied_pathIsSetToInput()
 		local inputFrameWork = 'somedir/Foo.framework'
 		links(inputFrameWork)
 		prepare()
 	end
 
 
+	function suite.PBXFileReference_UsesFullPath_WhenParentIsVirtual()
+		files { "src/source.c" }
+		vpaths { ["Source Files"] = "**.c" }
+		prepare()
+		xcode.PBXFileReference(tr)
+		test.capture [[
+/* Begin PBXFileReference section */
+		[source.c] /* source.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = "source.c"; path = "src/source.c"; sourceTree = "<group>"; };
+		]]
+	end
+
+
 ---------------------------------------------------------------------------
 -- PBXFrameworksBuildPhase tests
 ---------------------------------------------------------------------------
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.