Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(566)

Side by Side Diff: visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/GCCUtilities.cs

Issue 11266051: Add PNaCl support for VS addin. (Closed) Base URL: http://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: fix nits and tests Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 using System; 1 using System;
2 using System.Collections.Generic; 2 using System.Collections.Generic;
3 using System.Linq; 3 using System.Linq;
4 using System.Text; 4 using System.Text;
5 5
6 using System.IO; 6 using System.IO;
7 using System.Text.RegularExpressions; 7 using System.Text.RegularExpressions;
8 8
9 namespace NaCl.Build.CPPTasks 9 namespace NaCl.Build.CPPTasks
10 { 10 {
11 class GCCUtilities 11 class GCCUtilities
12 { 12 {
13 public const int s_CommandLineLength = 256; 13 public const int s_CommandLineLength = 256;
14 14
15 /// <summary>
16 /// Find python executable in user's PATH.
17 /// </summary>
18 public static bool FindPython()
19 {
20 string envvar = Environment.GetEnvironmentVariable("Path", Environme ntVariableTarget.Process);
21 List<string> pathList = new List<string>(envvar.Split(';'));
22 foreach (string path in pathList)
23 {
24 string testPath = Path.Combine(path, "python.bat");
25 if (File.Exists(testPath))
26 {
27 return true;
28 }
29 testPath = Path.Combine(path, "python.exe");
30 if (File.Exists(testPath))
31 {
32 return true;
33
34 }
35 }
36 return false;
37 }
38
15 public static string ConvertPathWindowsToPosix(string path) 39 public static string ConvertPathWindowsToPosix(string path)
16 { 40 {
17 return path.Replace('\\', '/'); 41 return path.Replace('\\', '/');
18 } 42 }
19 43
20 public static string ConvertPathPosixToWindows(string path) 44 public static string ConvertPathPosixToWindows(string path)
21 { 45 {
22 path = path.Replace('/', '\\'); 46 path = path.Replace('/', '\\');
23 // also make double backslashes a single slash 47 // also make double backslashes a single slash
24 // TODO: speed this up by iterating instead of two replaces 48 // TODO: speed this up by iterating instead of two replaces
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 }, 116 },
93 new GCCRegexLineConverter 117 new GCCRegexLineConverter
94 { 118 {
95 OutputExpression = new Regex(@"^\s*(.?.?[^:]*.*?):(.?.?[^:] *.*?):([1-9]\d*):(.*$)"), 119 OutputExpression = new Regex(@"^\s*(.?.?[^:]*.*?):(.?.?[^:] *.*?):([1-9]\d*):(.*$)"),
96 FilenameIdentifier = @"$2", 120 FilenameIdentifier = @"$2",
97 RemainderIdentifier = @"($3):'$1' $4" 121 RemainderIdentifier = @"($3):'$1' $4"
98 } 122 }
99 }; 123 };
100 } // GCCUtilities 124 } // GCCUtilities
101 } // namespace 125 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698