# HG changeset patch
# User Yuki KODAMA <[email protected]>
# Date 1243156511 -32400
# Node ID b303eb01df2f58402548114addef683653a9321e
# Parent  7368374fb0c5f71c873d7e3099725333f3610e48
thgconfig: correcting editor path if contains whitespace

this fix support some path patterns:
- c:\tools\editor.exe (no ws)
- "C:\Program Files\Foo\Bar.exe" (has ws, but bracketed)
- C:\Program Files\Foo\Bar.exe (has ws, not bracketed)

diff --git a/hggtk/thgconfig.py b/hggtk/thgconfig.py
--- a/hggtk/thgconfig.py
+++ b/hggtk/thgconfig.py
@@ -507,6 +507,9 @@
                 os.environ.get('HGEDITOR') or
                 u.config('ui', 'editor') or
                 os.environ.get('EDITOR', 'vi'))
+        # correcting path if contains whitespace in it
+        if editor.find(' ') != -1 and editor.count('"') != 2:
+            editor = '"' + editor + '"'
         if os.path.basename(editor) in ('vi', 'vim', 'hgeditor'):
             gdialog.Prompt(_('No visual editor configured'),
                    _('Please configure a visual editor.'), self).run()

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to