开发者

Xcode snapshots

开发者 https://www.devze.com 2022-12-21 19:48 出处:网络
What exactly does Xcode do with project snapshots after the Xcode project is moved or renamed. I have noticed they completely disapear...Where sh开发者_如何学JAVAould I look?

What exactly does Xcode do with project snapshots after the Xcode project is moved or renamed. I have noticed they completely disapear...Where sh开发者_如何学JAVAould I look?

Defintely not in ~/Library/Application Support/Developer/Shared/SnapshotRepository.sparseimage


~/Library/Application Support/Developer/Shared/SnapshotRepository.sparseimage is a disk image. You have to mount it and look in there.

Snapshots are stored based on a hash of the project name; change the project name and you lose the snapshot history. If you take a snapshot of the new project, and can find the old snapshot on the disk image, you can probably move the old snapshot into the new one's directory.


If they are not in ~/Library/Application Support/Developer/Shared/SnapshotRepository.sparseimage then I think you may be out of luck. I tend to rely on snapshots only as a first line of defence, with Time Machine as a more reliable second line, and then SCM and proper backups as the third and fourth.


They are inside the image allright... but making so that Xcode will recognize them won't be that easy...

In that image, you have the folder with all the snapshots (with some hierarchy)... and a plist file... in that plist file they have a HARDCODED (non relative to project file) paring system between each snapshot and the ORIGINAL PATH of the project folder.

So, if you really want to move/rename yar project, you'll need to change ALL the paths in that little plist file...

P.S. if you're gonna do the changes, you might wanna close Xcode before you do... it might make him angry... :P


Another thing you should be aware of:

If you open and mount ~/Library/Application Support/Developer/Shared/SnapshotRepository.sparseimage as a disk image and then start Xcode to recover or look into your snapshots Xcode will complain that the Snapshot Repository is broken and move it into the Trash!

So remember to unmount the repository before starting Xcode.

To recover a trashed Snapshot Repository just drag it into the correct path (see above) and remove the date stamp inside the filename.


I ran in to this issue having renamed the App and if I renamed it back to the original, quit Xcode and reopened it the restores were available again.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号