From 68665ebb450fb95e05e2b89b0477b8ebcb4977b2 Mon Sep 17 00:00:00 2001 From: monsta Date: Wed, 17 Feb 2016 11:15:21 +0300 Subject: plugins: some corrections for switch-c tool in external tools --- plugins/externaltools/data/switch-c.tool.in | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'plugins/externaltools') 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]) -- cgit v1.2.1