[meld: 1/3] meld/melddoc.py: Fix windows external open (#354)




commit fdb5ad969c3225328b0b617e305d1defe23dd468
Author: adam0antium <adam0antium gmail com>
Date:   Fri Aug 14 03:53:33 2020 +0100

    meld/melddoc.py: Fix windows external open (#354)
    
    When in a Meld folder comparison in Windows, a file or subfolder can be
    opened externally with default windows application (e.g. explorer for
    folders, previously selected application for files, or the windows
    file open option popup for unspecified types).
    
    Right-mouse button click and "Open externally" should produce this
    behaviour, however currently folders with spaces in the path produce
    unexpected behaviour such as command line windows opening.
    
    Changing the relevant system call from subprocess.Popen() to the
    windows-specific os.startfile() fixes this behaviour and handles paths
    with spaces in them in the expected way.
    
    https://gitlab.gnome.org/GNOME/meld/-/issues/354

 meld/melddoc.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/meld/melddoc.py b/meld/melddoc.py
index be96bb7a..8a3d0b20 100644
--- a/meld/melddoc.py
+++ b/meld/melddoc.py
@@ -16,6 +16,7 @@
 
 import enum
 import logging
+import os
 import pipes
 import shlex
 import string
@@ -127,7 +128,7 @@ class MeldDoc(LabeledObjectMixin, GObject.GObject):
             if not path:
                 return
             if sys.platform == "win32":
-                subprocess.Popen(["start", path], shell=True)
+                os.startfile(path)
             elif sys.platform == "darwin":
                 subprocess.Popen(["open", path])
             else:


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