The Blog

Aug 19, 2009

Saving OmniGraffle Documents in Subversion 

by Maxim Porges @ 5:00 PM | Link | Feedback (0)

I ran in to an issue today. We've been making a lot of wireframes for application user interfaces in OmniGraffle, and I wanted to get these in to version control along with everything else. Unfortunately, OmniGraffle typically stores files as bundles (special directories), and these bundles use OS X resource files for certain bits of the file format, which are fine for native OS X documents. However, these resource files have names like "Icon/r" (where /r is an escape sequence for a newline character), and that totally pisses off Subversion when committing resources.

Luckily, OmniGraffle offers the ability to save files as flat files rather than bundles. The files can end up being fatter on disk, but that's not really a problem considering how cheap disk space is today. You can go in to the Inspector for the document, and look in the Canvas accordion pane under the Document Settings tab. There, you will find a heading for "File format options", which by default seems to be set to "Automatic." You can change this to "Save as flat file", and save the document, and you are now ready to commit the file to Subversion.

However, I wanted to change the default file format to flat file so I don't have to go through this process every time. I Google'd a bit and found some suggestions for setting default preferences for the OmniGraffle app using "defaults write" from Terminal. Unfortunately, that option no longer seems to work for OmniGraffle 4.2 and up. I was, however, able to figure out the solution.

The problem seems to be that even with the defaults for the OmniGraffle app set to save to flat files, OmniGraffle always defers to the file format preference specified in the template that is used to create new documents. There are a set of document templates in the OmniGraffle application bundle that hold this setting, so you need to go in to each of these files and change the file format preference. You can find the location of these template files in the OmniGraffle preference pane under "Templates."

Once you have done changed the file format preference on the document templates, you are in business for all future documents created from those templates. This is how you do it.

1) Go to the OmniGraffle application bundle, right-click, and select "Show Package Contents."
2) Finder will show you the inside of application bundle. Navigate within the application bundle to Contents => Resources => Templates. In here, you will find a set of OmniGraffle documents that are used as your default document templates.
3) Open the document template that you want to modify. OmniGraffle launches and shows you the document.
4) Open the Inspector for the document, go to Document Settings under Canvas, and set the document template file's File Format option to "Save as flat file."
5) Save the document template.

Now, all new OmniGraffle documents created from that document template will also have their default preference set to "Save as flat file" since the template's preference has been set to that setting.

I hope this helps any other OmniGrafflers out there using Subversion!