Skip to content

Commit

Permalink
Merge pull request #1999 from Basewq/font_fix
Browse files Browse the repository at this point in the history
[Build] Fix native library loading picking up invalid files
  • Loading branch information
manio143 authored Oct 29, 2023
2 parents 7be9583 + 4681105 commit 83525ef
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions sources/shared/Stride.NuGetResolver/RestoreHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,29 @@ public static List<string> ListNativeLibs(LockFile lockFile)
{
foreach (var n in lib.NativeLibraries)
{
if (!IsValidNativeLibraryFile(n.Path))
{
continue;
}
var assemblyFile = Path.Combine(libPath, n.Path.Replace('/', Path.DirectorySeparatorChar));
libs.Add(assemblyFile);
}
}
}

return libs;

static bool IsValidNativeLibraryFile(string path)
{
if (path.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)
|| path.EndsWith(".so", StringComparison.OrdinalIgnoreCase)
|| path.Contains(".so.", StringComparison.OrdinalIgnoreCase) // Linux allows for files like 'libnativedep.so.6'
|| path.EndsWith(".dylib", StringComparison.OrdinalIgnoreCase))
{
return true;
}
return false;
}
}

private static Dictionary<(string, NuGetVersion), string> GetLibPaths(LockFile lockFile)
Expand Down

0 comments on commit 83525ef

Please # to comment.