summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-02-17 11:15:21 +0300
committermonsta <[email protected]>2016-02-17 11:15:21 +0300
commit68665ebb450fb95e05e2b89b0477b8ebcb4977b2 (patch)
treeb6713b004f6ea866e9de66fe8444dbc99edf4147
parent4d84579eace005ab4ab07646bc693da22c75bfc4 (diff)
downloadpluma-68665ebb450fb95e05e2b89b0477b8ebcb4977b2.tar.bz2
pluma-68665ebb450fb95e05e2b89b0477b8ebcb4977b2.tar.xz
plugins: some corrections for switch-c tool in external tools
-rw-r--r--plugins/externaltools/data/switch-c.tool.in22
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])