Skip to content

Commit

Permalink
DLL paths resolved to full paths (this is to avoid problems when usin…
Browse files Browse the repository at this point in the history
…g LoadLibrary with relative paths)
  • Loading branch information
lowleveldesign committed Nov 25, 2023
1 parent 54dd97c commit 971cb02
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion withdll/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ public static int Main(string[] args)
}

var dllpaths = (parsedArgs.TryGetValue("d", out var d1) ? d1 : new List<string>(0)).Union(
parsedArgs.TryGetValue("dll", out var d2) ? d2 : new List<string>(0)).ToList();
parsedArgs.TryGetValue("dll", out var d2) ? d2 : new List<string>(0))
.Select(Path.GetFullPath).Distinct().ToList();
if (dllpaths.FirstOrDefault(p => !Path.Exists(p)) is {} p)
{
Console.WriteLine($"Error: DLL file '{p}' does not exist");
return 1;
}

try
{
Expand Down
2 changes: 1 addition & 1 deletion withdll/withdll.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Copyright>2023 Sebastian Solnica</Copyright>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<AssemblyVersion>1.0.1.0</AssemblyVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down

0 comments on commit 971cb02

Please sign in to comment.