hackjutsu
hackjutsu

Reputation: 8922

Copy file full path in Xcode

I'm using Perforce for managing our code base. In Perforce, we need to check out a file before we can edit it. When I'm working in Xcode, sometimes I want to know the full path to the working file so that I can check it out in Perforce.

So here is my question:

Is there a shortcut, plugin or some other quick way to copy the full path of a file in Xcode?

What I have known:

  1. I can Command+click on the file tile to show up the full path, but I cannot copy it.
  2. In Visual Studio, we can right click on the file's tab and choose Copy Full Path to achieve this.
  3. In Eclipse, we can Alt/Option + Enter to achieve this.

Update:

Actually my question is about how to achieve the equivalent Copy Full Path feature inside Xcode. Anyway, dragging the file to the terminal is also a very nice workaround.

Upvotes: 9

Views: 9990

Answers (5)

Farhan Ar Rafi
Farhan Ar Rafi

Reputation: 148

Extending Caleb's answer, here is a graphical demo: Steps:

  1. Select a filename on the Project navigator from the left side Navigator panel.
  2. Tap on Show File Inspector from the right side Inspectors panel. (marked with red box)
  3. Copy the path from there. (marked with a bigger red box)

Screenshot of Xcode showing how to copy full file path

Upvotes: 5

Rick
Rick

Reputation: 39

You can use find command to copy file path:

cd myProject
find . -name myCodeFile.cpp

Upvotes: 0

dimaskpz
dimaskpz

Reputation: 87

on your editor XCode (you want to get the file path). Press:

Command+Shift+J

xcode will open directory file path on Project Navigator (left side bar)

and then drag-and-drop file from Project Navigator to the terminal. it will give you the directory of the file.

Upvotes: 1

Caleb
Caleb

Reputation: 124997

You can copy it directly out of the File Inspector. The first section ("Identity and Type") of the File Inspector shows information about the selected file, or the file that contains the selected symbol, etc. You have Name, Type, Location, and Full Path. You can select the full path and copy it.

As a shortcut, a triple click on any part of the path will select the entire path. There's also a small icon with a light arrow on a dark background -- clicking that will open a Finder window with the file selected.

Upvotes: 10

Carles Estevadeordal
Carles Estevadeordal

Reputation: 1229

You can drag it to a terminal... Easy and fast...

Upvotes: 7

Related Questions