Skip to content

Commit

Permalink
Merge pull request #27 from cmbuckley/omnigraffle7-export
Browse files Browse the repository at this point in the history
Fix OmniGraffle export for version 7
  • Loading branch information
fikovnik authored May 16, 2017
2 parents 1686802 + e94a0ac commit 3c94f26
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions omnigraffle_export/omnigraffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,16 @@ def __init__(self, og, doc):

def sandboxed(self):
# real check using '/usr/bin/codesign --display --entitlements - /Applications/OmniGraffle.app'
return self.og.version()[0] == '6' and os.path.exists(os.path.expanduser(OmniGraffle.SANDBOXED_DIR_6))
return self.og.version()[0] >= '6'

def get_sandbox_path(self):
version = self.og.version()[0]
path = os.path.expanduser(OmniGraffle.SANDBOXED_DIR % version)

if not os.path.exists(path):
raise RuntimeError('OmniGraffle is sandboxed but missing sandbox path: %s' % path)

return path

def get_canvas_list(self):
"""
Expand Down Expand Up @@ -68,7 +77,7 @@ def export(self, canvasname, fname, format='pdf'):
export_path = fname
# Is OmniGraffle sandboxed?
if self.sandboxed():
export_path = os.path.expanduser(OmniGraffle.SANDBOXED_DIR_6) + os.path.basename(fname)
export_path = self.get_sandbox_path() + os.path.basename(fname)
logging.debug('OmniGraffle is sandboxed - exporting to: %s' % export_path)

# FIXME: does this return something or throw something?
Expand Down Expand Up @@ -99,7 +108,7 @@ def active_canvas_name(self):

class OmniGraffle(object):

SANDBOXED_DIR_6 = '~/Library/Containers/com.omnigroup.OmniGraffle6/Data/'
SANDBOXED_DIR = '~/Library/Containers/com.omnigroup.OmniGraffle%s/Data/'

def __init__(self):
names = ['OmniGraffle 5.app', 'OmniGraffle Professional 5.app', 'OmniGraffle']
Expand Down

0 comments on commit 3c94f26

Please sign in to comment.