Loading...
Logo
Processing Forum
Hi
A long time ago I managed to retreive a sketch that crashed while running without having it saved (i know, i should have). Somewhere on the mac the latest run sketches are temporarily saved, but i can't remember where exactly and i've been looking around on my harddrive for an hour without finding it.
I've only found clues here regarding windows but not mac osx (lion, btw).
Does anyone know where these files are???

Replies(7)

Try searching for "sketch". I'm on Windows, so I can't particularly help you. The temporary sketch names are often cryptic, and a folder is created every time you click the run button until you save it. Sorting by date might help...
Thank you for the hint!
I already tried that because I remembered that the names began with sketch, but they can't be found... and i have all files included in the search...
Run the sketch (without saving it):
println(sketchPath);
It will print where this unsaved sketch is compiled. You will have a hint where your sketch might be.
Perfect!
Thank you very much!
In the meantime i already wrote the sketch that i lost again from scratch, but i'm sure this hint will be helpful again someday :)

This is the path in my Mac:
/private/var/folders/ry/ncychs9s2pd5cncqg93fx0zm0000gn/T/untitled2741293222982953006sketches
yes, Processing caches it's compiled java classes and a .java file every time you run a sketch, Apple will change where in the /var/folders/ directory this is. The fastest way to find the current location is to create a new sketch, don't save it and press command+k which will open up the subdirectory of /var/folders/ where the sketch is temporarily stored. You can control click on the folder name in the top of the window and it wil reveal the entire path. 

Very Important: 

OSX Clears thi cache folder on restart. If you need to recover your work after a crash you cannot let your system boot normally, it will delete the most recent unsaved version of the file. To recover the latest version of an unsaved sketch from a crashed mac, you need to start in target disk mode (hold T while starting up) then attach a cable between macs and manually locate the folder inside of /var/folders. You could also boot from the recovery image in lion and open a terminal, navigate to the /var/folders/... and copy the sketches to a folder in your home directory. Either way, if there is a crash and you need to recover the unsaved version, don't let the machine reboot. I lost a really cool little sketch tonight when my mac cycled power before I could stop it. Hope this helps people in the future.

" Hope this helps people in the future."
The best advice to help people in the future is to tell them to use a VCS, a version control system, like Bazaar, Mercurial or Git. And to push regularly to an online repository: this helps in reverting changes, and ensures a backup too.