Weird relative path while creating new files in Xcode. Is it related with macOS Catalina beta 4 version?
Asked Answered
J

1

5

I am not sure if it is related with beta software I am using. I've recorded a video which shows the problem:

https://youtu.be/AuxjNpylaMc

When I create new files in Xcode, they're put in super weird location which causes a lot of problems when pushing files to repository.

When I create a file in Xcode (no matter where in project, no matter which project I am loaded into, no matter where is the project located on my drive) this is how the relative path is generated:

../../../../../../System/Volumes/Data/Users/patryksredzinski/Desktop/PerfTester/PerfTester-Xcode/PerfTester-Xcode/wtfTableViewCell.swift

I've found out a solution which is to move the file in xcode project navigator to another group, which will make a copy of the file with valid path. I can then remove old file and move back copied version.

Is it related with macOS beta 4 version? Did they broke something? Is there any way to fix it?

(these invalid paths cause the project to work only on my machine)

macOS Catalina 10.15 Beta (19A512f) xcode Version 10.3 (10G8) (tested also on Xcode 11 beta 4 and same issue)

Jumper answered 25/7, 2019 at 7:23 Comment(5)
Please file a bug with Apple.Hazem
I had this, and also noticed that the affected file was not "registering" with the project as, in its case, a valid ViewController subclass in IB... Moving groups does fix it.Hurwit
are you able to resolve it?Boden
This is fixed on Catalina Beta 5.Imperfection
@Imperfection let's vote to close the question in that case.Balmung
T
8

I came across the same issue right after updating to macOS Catalina Beta 4 as well. Here is a workaround:

  1. Navigate to the project file in Finder, right click the xcodeproj > Open With > Other... > Enable: All Applications > [text editor of choice]. Open up the project.pbxproj file.

  2. Find the section named /* Begin PBXFileReference section */ and below it, locate the section where it says:

path = ../../../../../../System/Volumes/Data/Users/patryksredzinski/Desktop/PerfTester/PerfTester-Xcode/PerfTester-Xcode/wtfTableViewCell.swift

and replace it with path = wtfTableViewCell.swift.

  1. Save the file. Xcode should reflect the changes you made. To check, navigate to the inspector panel, under Identity and Type > Location, the path should now only display the [filename].swift.

Hopefully a permanent fix will come out soon.

Tightfisted answered 25/7, 2019 at 19:9 Comment(1)
A quicker solution that I've found is to move newly created files to another group in project, which will duplicate them, and moving files back to origin group. But still not a permanent solutionJumper

© 2022 - 2024 — McMap. All rights reserved.