Skip to content

Commit 9af6cb8

Browse files
committed
Quote packages.config paths
1 parent 2a62bfd commit 9af6cb8

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetExeWrapper.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ private string DownloadNugetExe(string sourceDir)
152152
private bool RunWithMono => !Win32.IsWindows() && !string.IsNullOrEmpty(Path.GetExtension(nugetExe));
153153

154154
/// <summary>
155-
/// Restore all files in a specified package.
155+
/// Restore all packages in the specified packages.config file.
156156
/// </summary>
157-
/// <param name="package">The package file.</param>
158-
private bool TryRestoreNugetPackage(string package)
157+
/// <param name="packagesConfig">The packages.config file.</param>
158+
private bool TryRestoreNugetPackage(string packagesConfig)
159159
{
160-
logger.LogInfo($"Restoring file {package}...");
160+
logger.LogInfo($"Restoring file \"{packagesConfig}\"...");
161161

162162
/* Use nuget.exe to install a package.
163163
* Note that there is a clutch of NuGet assemblies which could be used to
@@ -169,12 +169,12 @@ private bool TryRestoreNugetPackage(string package)
169169
if (RunWithMono)
170170
{
171171
exe = "mono";
172-
args = $"{nugetExe} install -OutputDirectory {packageDirectory} {package}";
172+
args = $"{nugetExe} install -OutputDirectory \"{packageDirectory}\" \"{packagesConfig}\"";
173173
}
174174
else
175175
{
176176
exe = nugetExe!;
177-
args = $"install -OutputDirectory {packageDirectory} {package}";
177+
args = $"install -OutputDirectory \"{packageDirectory}\" \"{packagesConfig}\"";
178178
}
179179

180180
var pi = new ProcessStartInfo(exe, args)
@@ -195,7 +195,7 @@ private bool TryRestoreNugetPackage(string package)
195195
}
196196
else
197197
{
198-
logger.LogInfo($"Restored file {package}");
198+
logger.LogInfo($"Restored file \"{packagesConfig}\"");
199199
return true;
200200
}
201201
}
@@ -205,7 +205,7 @@ private bool TryRestoreNugetPackage(string package)
205205
/// </summary>
206206
public int InstallPackages()
207207
{
208-
return fileProvider.PackagesConfigs.Count(package => TryRestoreNugetPackage(package));
208+
return fileProvider.PackagesConfigs.Count(TryRestoreNugetPackage);
209209
}
210210

211211
private bool HasNoPackageSource()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| [...]/Newtonsoft.Json.6.0.4/lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll |

0 commit comments

Comments
 (0)