Index: visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/GCCUtilities.cs |
diff --git a/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/GCCUtilities.cs b/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/GCCUtilities.cs |
index be3a5ef568d0a1e40604b20be1feb475ee43ff3a..fa8357b040d423afc651d20bd2fc3a149b0c9752 100644 |
--- a/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/GCCUtilities.cs |
+++ b/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/GCCUtilities.cs |
@@ -12,6 +12,30 @@ namespace NaCl.Build.CPPTasks |
{ |
public const int s_CommandLineLength = 256; |
+ /// <summary> |
+ /// Find python executable in user's PATH. |
+ /// </summary> |
+ public static bool FindPython() |
+ { |
+ string envvar = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Process); |
+ List<string> pathList = new List<string>(envvar.Split(';')); |
+ foreach (string path in pathList) |
+ { |
+ string testPath = Path.Combine(path, "python.bat"); |
+ if (File.Exists(testPath)) |
+ { |
+ return true; |
+ } |
+ testPath = Path.Combine(path, "python.exe"); |
+ if (File.Exists(testPath)) |
+ { |
+ return true; |
+ |
+ } |
+ } |
+ return false; |
+ } |
+ |
public static string ConvertPathWindowsToPosix(string path) |
{ |
return path.Replace('\\', '/'); |