From 943d6d5af6649818cdbcf4da6848324299c10cd1 Mon Sep 17 00:00:00 2001 From: Blue Falcon Date: Thu, 18 Jan 2024 21:28:51 -0700 Subject: [PATCH] feat: :sparkles: add a cache check to $bootstrapper.LoadNative() (#49) --- Import-Package/packaging.ps1 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Import-Package/packaging.ps1 b/Import-Package/packaging.ps1 index 59d0937..4d09c28 100644 --- a/Import-Package/packaging.ps1 +++ b/Import-Package/packaging.ps1 @@ -218,9 +218,14 @@ public static extern IntPtr dlopen(string path, int flags); If( -not (Test-Path $CopyTo -PathType Container) ){ New-Item -ItemType Directory -Path $CopyTo -Force } - Write-Verbose "Loading native dll from path '$CopyTo' (copied from '$Path')." - Copy-Item $Path $CopyTo -Force -ErrorAction SilentlyContinue | Out-Null - $Path = "$CopyTo\$($Path | Split-Path -Leaf)" + Write-Verbose "Loading native dll from path '$CopyTo' (copying from '$Path')." + $end_path = "$CopyTo\$($Path | Split-Path -Leaf)" + If( -not (Test-Path $end_path -PathType Leaf) ){ + Copy-Item $Path $CopyTo -Force -ErrorAction SilentlyContinue | Out-Null + } Else { + Write-Verbose "$CopyTo is already present and loaded. Native dll not copied - This could cause version conflicts" + } + $Path = $end_path } Else { Write-Verbose "Loading native dll from path '$Path'." }