This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
imp - doc - Separated .NET 4.8 bootables from .NET 6.0+ bootab...
...les There will be no more clashes between .NET 4.8 and .NET 6.0+ bootables so that conflicts don't happen. We've also added the BootFilePath to the manifest. --- GRILO 1.0.0 used to store all bootable files on one directory, regardless of whether bootable files are targeting the classic .NET 4.8 or the modern .NET 6.0+, but that caused problems. Now, GRILO was improved to separate the bootables to two different folders. --- Type: imp Breaking: False Doc Required: True Part: 1/1
- Loading branch information
Showing
4 changed files
with
107 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2022 Aptivi | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
#if NETCOREAPP | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime.Loader; | ||
|
||
namespace GRILO.Bootloader.BootApps | ||
{ | ||
public class BootLoadContext : AssemblyLoadContext | ||
{ | ||
internal AssemblyDependencyResolver resolver; | ||
internal string bootPath = ""; | ||
|
||
protected override Assembly Load(AssemblyName assemblyName) | ||
{ | ||
// Check to see if we have this assembly in the default context | ||
var finalAsm = Default.Assemblies.FirstOrDefault((asm) => asm.FullName == assemblyName.FullName); | ||
if (finalAsm is not null) | ||
return finalAsm; | ||
|
||
// Now, try to resolve | ||
string assemblyPath = resolver.ResolveAssemblyToPath(assemblyName); | ||
if (assemblyPath != null) | ||
return LoadFromAssemblyPath(assemblyPath); | ||
return null; | ||
} | ||
|
||
protected override IntPtr LoadUnmanagedDll(string unmanagedDllName) | ||
{ | ||
string libraryPath = resolver.ResolveUnmanagedDllToPath(unmanagedDllName); | ||
if (libraryPath != null) | ||
return LoadUnmanagedDllFromPath(libraryPath); | ||
return IntPtr.Zero; | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters