Skip to content

Commit 8d1752f

Browse files
author
Eric Miller
committed
Fix issue with Unity Data folder creating extraneous folders in Xcode project
1 parent 9997f2a commit 8d1752f

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

Sources/UBKit/Files/Unity/UnityEditorBuildScript.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ extension File {
6767
var pbxPath = Path.Combine(iOSProjectRoot, PbxFilePath);
6868
pbx.ReadFromFile(pbxPath);
6969
70-
var folderGuid = pbx.AddFolderReference(Path.Combine(folderRootPath, "Data"), Path.Combine(iOSProjectRoot, DataProjectPath), PBXSourceTree.Absolute);
70+
var folderGuid = pbx.AddFolderReference(Path.Combine(folderRootPath, "Data"), DataProjectPath, PBXSourceTree.Absolute);
7171
var targetGiud = pbx.TargetGuidByName(iOSProjectName);
7272
var resourceGiud = pbx.GetResourcesBuildPhaseByTarget(targetGiud);
7373
pbx.AddFileToBuildSection(targetGiud, resourceGiud, folderGuid);

Sources/UBKit/Workers/XcodeProject.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class XcodeProject {
3131
private let unityVersion: String
3232
private let projectPath: String
3333
private let vendorFolderPath: String
34+
private let vendorClassesFolderPath: String
35+
private let vendorLibrariesFolderPath: String
3436
private let specFileName: String
3537
private let bridgingFilesPath: String
3638

@@ -45,6 +47,8 @@ class XcodeProject {
4547

4648
self.projectPath = workingPath.appending(projectName).appending("/")
4749
self.vendorFolderPath = workingPath.appending("Vendor/UBK/")
50+
self.vendorClassesFolderPath = vendorFolderPath.appending("Classes")
51+
self.vendorLibrariesFolderPath = vendorFolderPath.appending("Libraries")
4852
self.specFileName = "project.yml"
4953
self.bridgingFilesPath = projectPath.appending("UnityBridge/")
5054
}
@@ -80,9 +84,9 @@ class XcodeProject {
8084
return unityFilesResult
8185
}
8286

83-
let unityFolderResult = createUnityVendorFolder()
84-
guard unityFolderResult == .success else {
85-
return unityFolderResult
87+
let unityFoldersResult = createUnityVendorFolders()
88+
guard unityFoldersResult == .success else {
89+
return unityFoldersResult
8690
}
8791

8892
let projectGenerationResult = generateXcodeProject()
@@ -211,9 +215,11 @@ private extension XcodeProject {
211215
}
212216
}
213217

214-
func createUnityVendorFolder() -> Result {
218+
func createUnityVendorFolders() -> Result {
215219
do {
216220
try fileManager.createDirectory(atPath: vendorFolderPath, withIntermediateDirectories: true, attributes: nil)
221+
try fileManager.createDirectory(atPath: vendorClassesFolderPath, withIntermediateDirectories: true, attributes: nil)
222+
try fileManager.createDirectory(atPath: vendorLibrariesFolderPath, withIntermediateDirectories: true, attributes: nil)
217223

218224
return .success
219225
} catch {

0 commit comments

Comments
 (0)