Browse Source

Fix 7z process arguments for paths with spaces

pull/16/head
Ionite 1 year ago
parent
commit
a1ba088b0f
No known key found for this signature in database
  1. 14
      StabilityMatrix/Helper/ArchiveHelper.cs

14
StabilityMatrix/Helper/ArchiveHelper.cs

@ -54,10 +54,9 @@ public static class ArchiveHelper
public static async Task<ArchiveInfo> Extract7Z(string archivePath, string extractDirectory) public static async Task<ArchiveInfo> Extract7Z(string archivePath, string extractDirectory)
{ {
var process = ProcessRunner.StartProcess(SevenZipPath, new[] var args =
{ $"x {ProcessRunner.Quote(archivePath)} -o{ProcessRunner.Quote(extractDirectory)} -y";
"x", archivePath, $"-o{ProcessRunner.Quote(extractDirectory)}", "-y" var process = ProcessRunner.StartProcess(SevenZipPath, args);
});
await ProcessRunner.WaitForExitConditionAsync(process); await ProcessRunner.WaitForExitConditionAsync(process);
var output = await process.StandardOutput.ReadToEndAsync(); var output = await process.StandardOutput.ReadToEndAsync();
var matches = Regex7ZOutput.Matches(output); var matches = Regex7ZOutput.Matches(output);
@ -85,10 +84,9 @@ public static class ArchiveHelper
progress.Report(new ProgressReport(-1, isIndeterminate: true, type: ProgressType.Extract)); progress.Report(new ProgressReport(-1, isIndeterminate: true, type: ProgressType.Extract));
// Need -bsp1 for progress reports // Need -bsp1 for progress reports
var process = ProcessRunner.StartProcess(SevenZipPath, new[] var args =
{ $"x {ProcessRunner.Quote(archivePath)} -o{ProcessRunner.Quote(extractDirectory)} -y -bsp1";
"x", archivePath, $"-o{ProcessRunner.Quote(extractDirectory)}", "-y", "-bsp1" var process = ProcessRunner.StartProcess(SevenZipPath, args, outputDataReceived: onOutput);
}, outputDataReceived: onOutput);
await process.WaitForExitAsync(); await process.WaitForExitAsync();

Loading…
Cancel
Save