Determine relative path for top-level groups

This commit is contained in:
Elliott Williams 2019-02-21 10:44:37 -08:00
parent 9f6f5210f7
commit 3b15144033
2 changed files with 2 additions and 2 deletions

View File

@ -254,7 +254,7 @@ class SourceGenerator {
let groupName = name ?? path.lastComponent
let groupPath = isTopLevelGroup ?
path.byRemovingBase(path: project.basePath).string :
((try? path.relativePath(from: project.basePath)) ?? path).string :
path.lastComponent
let group = PBXGroup(
children: children,

View File

@ -387,7 +387,7 @@ class SourceGeneratorTests: XCTestCase {
let pbxProj = try project.generatePbxProj()
try pbxProj.expectFile(paths: ["Sources", "A", "b.swift"], buildPhase: .sources)
try pbxProj.expectFile(paths: ["Sources", "F", "G", "h.swift"], buildPhase: .sources)
try pbxProj.expectFile(paths: [(outOfRootPath + "C/D").string, "e.swift"], names: ["D", "e.swift"], buildPhase: .sources)
try pbxProj.expectFile(paths: ["../OtherDirectory/C/D", "e.swift"], names: ["D", "e.swift"], buildPhase: .sources)
try pbxProj.expectFile(paths: ["Sources/B", "b.swift"], names: ["B", "b.swift"], buildPhase: .sources)
}