From db2065997c54cd7ec2ee0217936f852f2cb7f4f5 Mon Sep 17 00:00:00 2001
From: adrienmalin <41926238+adrienmalin@users.noreply.github.com>
Date: Fri, 15 Feb 2019 01:44:21 +0100
Subject: [PATCH] Update terminis.py

---
 terminis/terminis.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/terminis/terminis.py b/terminis/terminis.py
index d2c1980..687613c 100644
--- a/terminis/terminis.py
+++ b/terminis/terminis.py
@@ -13,6 +13,7 @@ import sched
 import time
 import os
 import locale
+import distutils.spawn
 try:
     import configparser
 except ImportError:
@@ -727,10 +728,10 @@ def main():
         
 def edit():
     if sys.platform == "win32":
-        if "PROGRAMFILES(X86)" in os.environ:
-            command = "notepad"
-        else:
+        if distutils.spawn.find_executable("edit"):
             command = "edit"
+        else:
+            command = "notepad"
     else:
         command = "${EDITOR:-vi}"
     os.system(command+" "+Controls.FILE_PATH)