mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Make it so you don't need to copy libsqlite3 on Linux anymore
This commit is contained in:
parent
f427e1db09
commit
3c2d98c5a3
@ -666,7 +666,7 @@
|
||||
<Compile Include="Server\Maintenance\ZipWriter.cs" />
|
||||
<Compile Include="util\Formatting\Wildcard.cs" />
|
||||
<Compile Include="util\ImageUtils.cs" />
|
||||
<Compile Include="util\NetBackend.cs" />
|
||||
<Compile Include="util\DotnetBackend.cs" />
|
||||
<Compile Include="util\NumberUtils.cs" />
|
||||
<Compile Include="util\OperatingSystem.cs" />
|
||||
<Compile Include="Server\Server.cs" />
|
||||
|
@ -1,8 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<DefineConstants>$(DefineConstants);MCG_DOTNET</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MySql.Data" Version="8.1.0" />
|
||||
|
@ -1,9 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<DefineConstants>$(DefineConstants);MCG_STANDALONE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);MCG_DOTNET;MCG_STANDALONE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.8" />
|
||||
|
@ -42,7 +42,7 @@ using System.Text.RegularExpressions;
|
||||
|
||||
namespace MCGalaxy.Modules.Compiling
|
||||
{
|
||||
#if !NETSTANDARD
|
||||
#if !MCG_DOTNET
|
||||
/// <summary> Compiles source code files from a particular language, using a CodeDomProvider for the compiler </summary>
|
||||
public static class ICodeDomCompiler
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ namespace MCGalaxy.Modules.Compiling
|
||||
public override string ShortName { get { return "C#"; } }
|
||||
public override string FullName { get { return "CSharp"; } }
|
||||
|
||||
#if !NETSTANDARD
|
||||
#if !MCG_DOTNET
|
||||
CodeDomProvider compiler;
|
||||
|
||||
protected override ICompilerErrors DoCompile(string[] srcPaths, string dstPath) {
|
||||
|
@ -84,6 +84,7 @@ namespace MCGalaxy
|
||||
levelConfig = ConfigElement.GetAll(typeof(LevelConfig));
|
||||
zoneConfig = ConfigElement.GetAll(typeof(ZoneConfig));
|
||||
|
||||
DotNetBackend.Init();
|
||||
IOperatingSystem.DetectOS().Init();
|
||||
|
||||
StartTime = DateTime.UtcNow;
|
||||
|
@ -23,7 +23,7 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace MCGalaxy.Platform
|
||||
{
|
||||
#if !NETSTANDARD
|
||||
#if !MCG_DOTNET
|
||||
public static class DotNetBackend
|
||||
{
|
||||
public static void Init() { }
|
||||
@ -44,7 +44,13 @@ namespace MCGalaxy.Platform
|
||||
}
|
||||
|
||||
static IntPtr ImportResolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath) {
|
||||
return IntPtr.Zero;
|
||||
IntPtr libHandle = IntPtr.Zero;
|
||||
|
||||
// Since otherwise it's not always found on Linux
|
||||
if (libraryName == "sqlite3") {
|
||||
NativeLibrary.TryLoad("libsqlite3.so.0", assembly, DllImportSearchPath.System32, out libHandle);
|
||||
}
|
||||
return libHandle;
|
||||
}
|
||||
|
||||
|
||||
@ -63,8 +69,8 @@ namespace MCGalaxy.Platform
|
||||
// https://learn.microsoft.com/en-us/dotnet/core/dependency-loading/default-probing?source=recommendations#how-are-the-properties-populated
|
||||
|
||||
try {
|
||||
AssemblyName name = new AssemblyName(name);
|
||||
string path = name.Name + ".dll";
|
||||
AssemblyName assemName = new AssemblyName(name);
|
||||
string path = assemName.Name + ".dll";
|
||||
if (File.Exists(path)) return Assembly.LoadFrom(path);
|
||||
} catch (Exception ex) {
|
||||
Logger.LogError("Resolving plugin DLL reference", ex);
|
@ -16,7 +16,7 @@
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
#if !NETSTANDARD
|
||||
#if !MCG_DOTNET
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
@ -55,7 +55,7 @@ namespace MCGalaxy.Util
|
||||
|
||||
public abstract void Dispose();
|
||||
|
||||
#if !NETSTANDARD
|
||||
#if !MCG_DOTNET
|
||||
public static IBitmap2D Create() { return new GDIPlusBitmap(); }
|
||||
#else
|
||||
public static IBitmap2D Create() { return new ImageSharpBitmap(); }
|
||||
@ -94,7 +94,7 @@ namespace MCGalaxy.Util
|
||||
}
|
||||
|
||||
|
||||
#if !NETSTANDARD
|
||||
#if !MCG_DOTNET
|
||||
unsafe sealed class GDIPlusBitmap : IBitmap2D
|
||||
{
|
||||
Image img;
|
||||
|
@ -183,7 +183,7 @@ namespace MCGalaxy.Platform
|
||||
execvp(exe, new string[] { exe, Server.RestartPath, null });
|
||||
Console.WriteLine("execvp {0} failed: {1}", exe, Marshal.GetLastWin32Error());
|
||||
|
||||
#if !NETSTANDARD
|
||||
#if !MCG_DOTNET
|
||||
// .. and fallback to mono if that doesn't work for some reason
|
||||
execvp("mono", new string[] { "mono", Server.RestartPath, null });
|
||||
Console.WriteLine("execvp mono failed: {0}", Marshal.GetLastWin32Error());
|
||||
|
@ -84,9 +84,6 @@ Compiling - .NET 6 / .NET 7 / .NET 8
|
||||
* Compiling for .NET 7: Navigate into `CLI` directory, and then run `dotnet build MCGalaxyCLI_dotnet7.csproj`
|
||||
* Compiling for .NET 8: Navigate into `CLI` directory, and then run `dotnet build MCGalaxyCLI_dotnet8.csproj`
|
||||
|
||||
Linux notes:
|
||||
**You will also need to copy `libsqlite3.so.0` from system libraries to `libsqlite3.so` in the server folder**
|
||||
|
||||
Copyright/License
|
||||
-----------------
|
||||
See LICENSE for MCGalaxy license, and license.txt for code used from other software.
|
||||
|
Loading…
x
Reference in New Issue
Block a user