# HG changeset patch
# User Edouard Tisserant
# Date 1565607971 -7200
# Node ID 40c4449001dfe01bfbbdc9cd22ca834917858b80
# Parent  3ba6a2d26507cb9b20ad8ab0b125a69ca597a1b1
Allow using docutil.get_inkscape_path() on Linux also.

diff -r 3ba6a2d26507 -r 40c4449001df docutil/docsvg.py
--- a/docutil/docsvg.py	Fri Aug 09 12:07:33 2019 +0200
+++ b/docutil/docsvg.py	Mon Aug 12 13:06:11 2019 +0200
@@ -31,15 +31,19 @@
 
 def get_inkscape_path():
     """ Return the Inkscape path """
-    from six.moves import winreg
-    try:
-        svgexepath = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE,
-                                       'Software\\Classes\\svgfile\\shell\\Inkscape\\command')
-    except OSError:
-        svgexepath = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE,
-                                       'Software\\Classes\\inkscape.svg\\shell\\open\\command')
-    svgexepath = svgexepath.replace('"%1"', '')
-    return svgexepath.replace('"', '')
+    if wx.Platform == '__WXMSW__':
+        from six.moves import winreg
+        try:
+            svgexepath = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE,
+                                           'Software\\Classes\\svgfile\\shell\\Inkscape\\command')
+        except OSError:
+            svgexepath = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE,
+                                           'Software\\Classes\\inkscape.svg\\shell\\open\\command')
+        svgexepath = svgexepath.replace('"%1"', '').strip()
+        return svgexepath.replace('"', '')
+    else:
+        # TODO: search path
+        return os.path.join("/usr/bin", "inkscape")
 
 
 def open_win_svg(svgexepath, svgfile):
@@ -65,7 +69,7 @@
             wx.MessageBox("Inkscape is not found or installed !")
             return None
     else:
-        svgexepath = os.path.join("/usr/bin", "inkscape")
+        svgexepath=get_inkscape_path()
         if os.path.isfile(svgexepath):
             open_lin_svg(svgexepath, svgfile)
         else: