diff options
Diffstat (limited to 'plugins/externaltools/data')
-rw-r--r-- | plugins/externaltools/data/switch-c.tool.in | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/plugins/externaltools/data/switch-c.tool.in b/plugins/externaltools/data/switch-c.tool.in index f9a2ffeb..9d3a01cc 100644 --- a/plugins/externaltools/data/switch-c.tool.in +++ b/plugins/externaltools/data/switch-c.tool.in @@ -20,13 +20,19 @@ import os import subprocess -name = os.environ["PLUMA_CURRENT_DOCUMENT_NAME"] -filename, ext = os.path.splitext(name) +try: + name = os.environ["PLUMA_CURRENT_DOCUMENT_NAME"] +except KeyError: + exit(1) -if name.endswith('.c'): - filename = "%s.h" % filename - subprocess.Popen(["pluma", filename]) +f, ext = os.path.splitext(name) +nxt = '' -if name.endswith('.h'): - filename = "%s.c" % filename - subprocess.Popen(["pluma", filename]) +if ext == '.c': + nxt = '.h' + +if ext == '.h': + nxt = '.c' + +if nxt: + subprocess.call(['/usr/bin/pluma', f+nxt]) |