Skip to content

Commit

Permalink
Added: Cleanup unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Nov 27, 2024
1 parent 91ea66b commit a4fa5be
Showing 1 changed file with 2 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public ProtontricksFlatpakDependency(IProcessFactory processFactory) : base(proc
/// <inheritdoc />
protected override Command BuildQueryCommand(PipeTarget outputPipeTarget)
{
// This will return a non-zero code if neither flatpak or protontricks are installed
// Which in turn will be recognised as a missing dependency.
var command = Cli.Wrap("flatpak")
.WithArguments($"run {FlatpakPackageId} --version")
.WithStandardOutputPipe(outputPipeTarget);
Expand All @@ -46,25 +48,4 @@ public ValueTask<Command> MakeLaunchCommand(Command command, long appId)
command.WorkingDirPath, command.Credentials, command.EnvironmentVariables,
command.Validation, command.StandardInputPipe, command.StandardOutputPipe, command.StandardErrorPipe));
}

/// <summary>
/// Checks if the Protontricks Flatpak is installed on the system.
/// </summary>
/// <returns>True if the Flatpak is installed, false otherwise.</returns>
public async Task<bool> IsFlatpakInstalledAsync()
{
try
{
var result = await Cli.Wrap("flatpak")
.WithArguments($"info {FlatpakPackageId}")
.WithValidation(CommandResultValidation.None)
.ExecuteAsync();

return result.ExitCode == 0;
}
catch
{
return false;
}
}
}

0 comments on commit a4fa5be

Please sign in to comment.