Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Just a quick bit of background. I am a long time Windows, C# developer and for a new project for my employer, I've had to transition to OSX and begin learning iOS development. In other words, I'm still quite new to the Mac/OSX environment.

Earlier today I decided that I'd close out of XCode and re-organize my testing and learning project, and projects that I've created in XCode that hold assets I will most likely need to reuse. When I fired XCode back up, I was surprised to see that all of my recent projects were still in the Recents list and they were pointing to the new file location! Sweet!

How did XCode know where my projects were located? Is a function of the Operating System, the File System or does XCode have some form of intelligence built into the system to detect these type of questions?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

This functionality is available from pretty much every application's File » Open Recent menu provided by the convenience methods in LaunchServices/LSSharedFilesList.h (which is also the name of the plist files storing this information, e.g. ~/Library/Preferences/com.apple.Preview.LSSharedFilesList.plist).

These entries contain a serialized NSData (presumably), which you can copy and write to a file e.g. using a hex editor. They contain the full path to the file, the volume name the file is on, a UUID, and some additional information I currently cannot make sense if. I assume that the UUID is used to resolve the file reference if needed.

NSURLs can be converted to file references that can be resolved later, even when a file has moved. This answer on StackOverflow has more technical information.

I'm not sure, but HFS+ has inodes that uniquely identify a file. The NSURL functionality is possibly implemented on top of that. The observable behavior seems to indicate this: If you move a file to a different file system, it is removed from the Open Recent list of files, probably because it can no longer be resolved.

share|improve this answer
An interesting information for everyone coming from Linux: HFS+/OS X store an additional datum for files that can be accessed using stat: The birth time B of the node (in addition to access a, change c, and modification m). Not sure whether this is specific to OS X or more common. –  Daniel Beck Dec 15 '11 at 14:21
Birth time exists in other Unixlike systems. I...think FreeBSD and Solaris have it; I also remember seeing patches for Linux and ext4. –  grawity Dec 15 '11 at 16:36
@grawity So FreeBSD is probably where it's from. Good to know. –  Daniel Beck Dec 15 '11 at 16:38

I don't know how XCode does that, but here's a generic answer.

In addition to paths, filesystem objects can have other identifiers, such as the inode number on Unix filesystemes or object ID on Windows NTFS, which can often be used to find all paths to a file with known ID. This identifier or number always remains the same as long as the object itself remains in the same filesystem, regardless of which directory you move it to.

Objects also have other, more visible but less reliable metadata such as the name, creation date, or size. If the object's ID is unknown or was not found anywhere, the program might search all filesystems for any object with the same name, type and size, or using other criteria. This is what Mac OS X Aliases and Windows Shortcuts do when their original target is missing (although shortcuts only work in the Windows shell, while aliases are more integrated with Mac OS).

It could be that XCode just uses the same functions used for resolving broken aliases.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.