diff options
Diffstat (limited to 'src/WixToolset.Core/CommandLine/ParseCommandLine.cs')
-rw-r--r-- | src/WixToolset.Core/CommandLine/ParseCommandLine.cs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/WixToolset.Core/CommandLine/ParseCommandLine.cs b/src/WixToolset.Core/CommandLine/ParseCommandLine.cs index 7d0dcbd8..3cf6e032 100644 --- a/src/WixToolset.Core/CommandLine/ParseCommandLine.cs +++ b/src/WixToolset.Core/CommandLine/ParseCommandLine.cs | |||
@@ -25,11 +25,14 @@ namespace WixToolset.Core.CommandLine | |||
25 | this.ErrorArgument = errorArgument; | 25 | this.ErrorArgument = errorArgument; |
26 | } | 26 | } |
27 | 27 | ||
28 | public bool IsSwitch(string arg) => !String.IsNullOrEmpty(arg) && ('/' == arg[0] || '-' == arg[0]); | 28 | public bool IsSwitch(string arg) |
29 | { | ||
30 | return !String.IsNullOrEmpty(arg) && ('/' == arg[0] || '-' == arg[0]); | ||
31 | } | ||
29 | 32 | ||
30 | public void GetArgumentAsFilePathOrError(string argument, string fileType, IList<string> paths) | 33 | public void GetArgumentAsFilePathOrError(string argument, string fileType, IList<string> paths) |
31 | { | 34 | { |
32 | foreach (var path in GetFiles(argument, fileType)) | 35 | foreach (var path in this.GetFiles(argument, fileType)) |
33 | { | 36 | { |
34 | paths.Add(path); | 37 | paths.Add(path); |
35 | } | 38 | } |
@@ -60,7 +63,7 @@ namespace WixToolset.Core.CommandLine | |||
60 | 63 | ||
61 | public string GetNextArgumentAsDirectoryOrError(string commandLineSwitch) | 64 | public string GetNextArgumentAsDirectoryOrError(string commandLineSwitch) |
62 | { | 65 | { |
63 | if (this.TryGetNextNonSwitchArgumentOrError(out var arg) && TryGetDirectory(commandLineSwitch, this.Messaging, arg, out var directory)) | 66 | if (this.TryGetNextNonSwitchArgumentOrError(out var arg) && this.TryGetDirectory(commandLineSwitch, this.Messaging, arg, out var directory)) |
64 | { | 67 | { |
65 | return directory; | 68 | return directory; |
66 | } | 69 | } |
@@ -71,7 +74,7 @@ namespace WixToolset.Core.CommandLine | |||
71 | 74 | ||
72 | public bool GetNextArgumentAsDirectoryOrError(string commandLineSwitch, IList<string> directories) | 75 | public bool GetNextArgumentAsDirectoryOrError(string commandLineSwitch, IList<string> directories) |
73 | { | 76 | { |
74 | if (this.TryGetNextNonSwitchArgumentOrError(out var arg) && TryGetDirectory(commandLineSwitch, this.Messaging, arg, out var directory)) | 77 | if (this.TryGetNextNonSwitchArgumentOrError(out var arg) && this.TryGetDirectory(commandLineSwitch, this.Messaging, arg, out var directory)) |
75 | { | 78 | { |
76 | directories.Add(directory); | 79 | directories.Add(directory); |
77 | return true; | 80 | return true; |
@@ -96,7 +99,7 @@ namespace WixToolset.Core.CommandLine | |||
96 | { | 99 | { |
97 | if (this.TryGetNextNonSwitchArgumentOrError(out var arg)) | 100 | if (this.TryGetNextNonSwitchArgumentOrError(out var arg)) |
98 | { | 101 | { |
99 | foreach (var path in GetFiles(arg, fileType)) | 102 | foreach (var path in this.GetFiles(arg, fileType)) |
100 | { | 103 | { |
101 | paths.Add(path); | 104 | paths.Add(path); |
102 | } | 105 | } |
@@ -125,7 +128,10 @@ namespace WixToolset.Core.CommandLine | |||
125 | return result; | 128 | return result; |
126 | } | 129 | } |
127 | 130 | ||
128 | private static bool IsValidArg(string arg) => !(String.IsNullOrEmpty(arg) || '/' == arg[0] || '-' == arg[0]); | 131 | private static bool IsValidArg(string arg) |
132 | { | ||
133 | return !(String.IsNullOrEmpty(arg) || '/' == arg[0] || '-' == arg[0]); | ||
134 | } | ||
129 | 135 | ||
130 | private static bool TryDequeue(Queue<string> q, out string arg) | 136 | private static bool TryDequeue(Queue<string> q, out string arg) |
131 | { | 137 | { |
@@ -194,8 +200,8 @@ namespace WixToolset.Core.CommandLine | |||
194 | } | 200 | } |
195 | 201 | ||
196 | // Convert alternate directory separators to the standard one. | 202 | // Convert alternate directory separators to the standard one. |
197 | string filePath = searchPath.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); | 203 | var filePath = searchPath.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); |
198 | int lastSeparator = filePath.LastIndexOf(Path.DirectorySeparatorChar); | 204 | var lastSeparator = filePath.LastIndexOf(Path.DirectorySeparatorChar); |
199 | var files = new string[0]; | 205 | var files = new string[0]; |
200 | 206 | ||
201 | try | 207 | try |