diff --git a/BeefLibs/Beefy2D/src/gfx/Image.bf b/BeefLibs/Beefy2D/src/gfx/Image.bf index f5db7e87..c4279ec4 100644 --- a/BeefLibs/Beefy2D/src/gfx/Image.bf +++ b/BeefLibs/Beefy2D/src/gfx/Image.bf @@ -103,6 +103,7 @@ namespace Beefy.gfx scope AutoBeefPerf("Image.LoadFromFile"); var useFileName = scope String()..Append(fileName); + useFileName.Replace('\\', '/'); FilePackManager.TryMakeMemoryString(useFileName); void* aNativeTextureSegment = Gfx_LoadTexture(useFileName, (int32)flags); if (aNativeTextureSegment == null) diff --git a/BeefLibs/corlib/src/IO/FileDialog.bf b/BeefLibs/corlib/src/IO/FileDialog.bf index 6b4893c8..6aaf47cb 100644 --- a/BeefLibs/corlib/src/IO/FileDialog.bf +++ b/BeefLibs/corlib/src/IO/FileDialog.bf @@ -623,6 +623,9 @@ abstract class CommonDialog public Result ShowDialog(INativeWindow owner = null) { + if (!Linux.IsSystemdAvailable) + return .Err; + TryC!(Linux.SdBusOpenUser(&mBus)); // Maybe keep the bus open while the program is running ? Linux.DBusMsg* call = ?; diff --git a/BeefLibs/corlib/src/Linux.bf b/BeefLibs/corlib/src/Linux.bf index fe07c556..452a6f9e 100644 --- a/BeefLibs/corlib/src/Linux.bf +++ b/BeefLibs/corlib/src/Linux.bf @@ -44,6 +44,33 @@ class Linux public typealias DBusMsgHandler = function int32(DBusMsg *m, void *userdata, DBusErr *ret_error); + public static bool IsSystemdAvailable { get; private set; } = true; + + [AlwaysInclude, StaticInitPriority(100)] + static class AllowFail + { + public static this() + { + Runtime.AddErrorHandler(new => Handle); + } + + public static Runtime.ErrorHandlerResult Handle(Runtime.ErrorStage errorStage, Runtime.Error error) + { + if (errorStage == .PreFail) + { + if (var loadLibaryError = error as Runtime.LoadSharedLibraryError) + { + if (loadLibaryError.mPath == "libsystemd.so") + { + IsSystemdAvailable = false; + return .Ignore; + } + } + } + return .ContinueFailure; + } + } + [Import("libsystemd.so"), LinkName("sd_bus_open_user")] public static extern c_int SdBusOpenUser(DBus **ret); [Import("libsystemd.so"), LinkName("sd_bus_open_system")] diff --git a/BeefLibs/corlib/src/String.bf b/BeefLibs/corlib/src/String.bf index 088cfa81..9073d988 100644 --- a/BeefLibs/corlib/src/String.bf +++ b/BeefLibs/corlib/src/String.bf @@ -972,6 +972,9 @@ namespace System public void Append(char8* appendPtr, int length) { + Debug.Assert(length >= 0); + if (length <= 0) + return; int newCurrentIndex = mLength + length; char8* ptr; if (newCurrentIndex > AllocSize) @@ -996,6 +999,9 @@ namespace System public void Append(char8[] arr, int idx, int length) { + Debug.Assert(length >= 0); + if (length <= 0) + return; int newCurrentIndex = mLength + length; char8* ptr; if (newCurrentIndex > AllocSize) diff --git a/IDE/src/IDEApp.bf b/IDE/src/IDEApp.bf index 1b03083d..55033a0e 100644 --- a/IDE/src/IDEApp.bf +++ b/IDE/src/IDEApp.bf @@ -3438,6 +3438,8 @@ namespace IDE delete mWorkspace.mDir; mWorkspace.mDir = newPath; } + else if (mWorkspace.mDir == null) + mWorkspace.mDir = new String(); List platforms = scope List(); if (IDEApp.sPlatform32Name != null)