Skip to content

Commit

Permalink
Merge pull request #18 from StefanKoell/custom-exe-path
Browse files Browse the repository at this point in the history
Support for custom wfreerdp.exe path
  • Loading branch information
StefanKoell authored Nov 7, 2022
2 parents 5ea369e + 5fa6326 commit 8626b75
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,12 @@ public class FreeRdpConfiguration : IValidatableObject
/// SmartReconnect: When enabled, the connection will be re-established to adapt to the new desktop size
/// </summary>
public bool SmartReconnect { get; set; }


/// <summary>
/// The full path to an alternative wfreerdp.exe
/// </summary>
public string? Executable { get; set; }

/// <summary>
/// TempPath: The directory where wfreerdp.exe is written to if not already available
/// </summary>
Expand Down
18 changes: 14 additions & 4 deletions src/RoyalApps.Community.FreeRdp.WinForms/FreeRdpControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,20 @@ public void Connect()

// AutoScrollMinSize is required to get scrollbars to appear
AutoScrollMinSize = _renderTarget.Size;

var freeRdpPath =
Environment.ExpandEnvironmentVariables(Path.Combine(Configuration.TempPath, WFREERDP_EXE));
VerifyExecutable(freeRdpPath);

var freeRdpPath = Environment.ExpandEnvironmentVariables(Path.Combine(Configuration.TempPath, WFREERDP_EXE));
if (!string.IsNullOrWhiteSpace(Configuration.Executable))
{
var customPath = Environment.ExpandEnvironmentVariables(Configuration.Executable!);
if (File.Exists(customPath))
{
freeRdpPath = customPath;
}
}
else
{
VerifyExecutable(freeRdpPath);
}

var arguments = Configuration.GetArguments();
_process = new Process
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>RoyalApps_1024.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>1.2.2</Version>
<Version>1.2.3</Version>
<Nullable>enable</Nullable>
<LangVersion>10</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down

0 comments on commit 8626b75

Please sign in to comment.