[meld] Try both which and where on Windows



commit af071f4fd0a594c0af2fb565e6bd73fbfd3c3ffe
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Mar 31 14:18:42 2013 +1000

    Try both which and where on Windows
    
    Many people running Meld on Windows are doing so in Unix environments,
    but not all tools are always around. This commit lets us fall back to
    the 'where' builtin on Windows, which lets us work with e.g., the
    default msysgit shell.

 meld/vcview.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/meld/vcview.py b/meld/vcview.py
index 5afdb8f..54630fb 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -300,7 +300,15 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
             # check fails don't let the user select the that version control
             # tool and display a basic error message in the drop-down menu.
             err_str = ""
-            if vc._vc.call(["which", avc.CMD]):
+
+            def vc_installed(cmd):
+                try:
+                    return not vc._vc.call(["which", cmd])
+                except OSError:
+                    if os.name == 'nt':
+                        return not vc._vc.call(["where", cmd])
+
+            if not vc_installed(avc.CMD):
                 # TRANSLATORS: this is an error message when a version control
                 # application isn't installed or can't be found
                 err_str = _("%s Not Installed" % avc.CMD)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]