Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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)

like image 768
XFawkes Avatar asked Jul 25 '19 07:07

XFawkes


People also ask

How do I change the path of a file in Xcode?

Clicking on the Folder icon next to the name will bring up an open panel from which you can choose the correct location of the file.

Which file to open in Xcode?

Importing into Xcode xcodeproj” extension in the root directory. Select the file and click Open. Xcode will open the project. On the left side you will see the Project Navigator, with a folder representing your project by name.

How do I open a Xcodeproj file on a Mac?

You can only open XCODEPROJ files with Apple Xcode in macOS. To open the file, select File → Open....


1 Answers

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.

like image 103
Christopher Louie Avatar answered Oct 24 '22 06:10

Christopher Louie