22 Function to get the full path of the Mercurial executable. |
22 Function to get the full path of the Mercurial executable. |
23 |
23 |
24 @return path of the Mercurial executable |
24 @return path of the Mercurial executable |
25 @rtype str |
25 @rtype str |
26 """ |
26 """ |
27 exe = "" |
27 from Plugins.PluginVcsMercurial import VcsMercurialPlugin |
28 program = "hg" |
28 |
29 if isWindowsPlatform(): |
29 exe = VcsMercurialPlugin.getPreferences("MercurialExecutablePath") |
30 program += ".exe" |
30 if not exe: |
31 dirName = os.path.dirname(sys.executable) |
31 program = "hg" |
32 if os.path.exists(os.path.join(dirName, program)): |
32 if isWindowsPlatform(): |
33 exe = os.path.join(dirName, program) |
33 program += ".exe" |
34 elif os.path.exists(os.path.join(dirName, "Scripts", program)): |
34 dirName = os.path.dirname(sys.executable) |
35 exe = os.path.join(dirName, "Scripts", program) |
35 if os.path.exists(os.path.join(dirName, program)): |
36 else: |
36 exe = os.path.join(dirName, program) |
37 dirName = os.path.dirname(sys.executable) |
37 elif os.path.exists(os.path.join(dirName, "Scripts", program)): |
38 if os.path.exists(os.path.join(dirName, program)): |
38 exe = os.path.join(dirName, "Scripts", program) |
39 exe = os.path.join(dirName, program) |
39 else: |
|
40 dirName = os.path.dirname(sys.executable) |
|
41 if os.path.exists(os.path.join(dirName, program)): |
|
42 exe = os.path.join(dirName, program) |
40 |
43 |
41 if not exe: |
44 if not exe: |
42 exe = program |
45 exe = program |
43 |
46 |
44 return exe |
47 return exe |