diff options
author | monsta <[email protected]> | 2016-02-17 11:15:21 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2016-02-17 11:15:21 +0300 |
commit | 68665ebb450fb95e05e2b89b0477b8ebcb4977b2 (patch) | |
tree | b6713b004f6ea866e9de66fe8444dbc99edf4147 /plugins/externaltools | |
parent | 4d84579eace005ab4ab07646bc693da22c75bfc4 (diff) | |
download | pluma-68665ebb450fb95e05e2b89b0477b8ebcb4977b2.tar.bz2 pluma-68665ebb450fb95e05e2b89b0477b8ebcb4977b2.tar.xz |
plugins: some corrections for switch-c tool in external tools
Diffstat (limited to 'plugins/externaltools')
-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]) |