Skip to content

Commit

Permalink
Binarize needs to have project drive as current directory
Browse files Browse the repository at this point in the history
  • Loading branch information
jetelain committed Aug 23, 2023
1 parent 9d902a9 commit b6e0529
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions GameRealisticMap.Arma3/Arma3ToolsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ internal static async Task RunBinarize(IProgressSystem system, string arguments)
&& !output.Contains(": ")
&& !output.Contains("Info: Persistence detected on")
&& !output.Contains("Creating process:")
&& output != "---------------------------------------------"
&& output != "---------------------------------------------",
GetProjectDrivePath()
);
if (rc != 0)
{
Expand Down Expand Up @@ -148,7 +149,7 @@ await Parallel.ForEachAsync(paths, options, async (path, _) =>
}).ConfigureAwait(false);
}

internal static async Task<int> Run(IProgressSystem system, string executable, string arguments, Func<string, bool>? outputFilter = null)
internal static async Task<int> Run(IProgressSystem system, string executable, string arguments, Func<string, bool>? outputFilter = null, string? workingDirectory = null)
{
var options = new ProcessStartInfo()
{
Expand All @@ -160,6 +161,10 @@ internal static async Task<int> Run(IProgressSystem system, string executable, s
Arguments = arguments,
UseShellExecute = false
};
if ( !string.IsNullOrEmpty(workingDirectory) )
{
options.WorkingDirectory = workingDirectory;
}
var process = Process.Start(options)!;
process.OutputDataReceived += (_, e) => { if (!string.IsNullOrEmpty(e.Data) && (outputFilter == null || outputFilter(e.Data))) { system.WriteLine(e.Data); } };
process.ErrorDataReceived += (_, e) => { if (!string.IsNullOrEmpty(e.Data) && (outputFilter == null || outputFilter(e.Data))) { system.WriteLine(e.Data); } };
Expand Down

0 comments on commit b6e0529

Please sign in to comment.