Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion BeefLibs/Beefy2D/src/gfx/Font.bf
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,14 @@ namespace Beefy.gfx
#if BF_PLATFORM_LINUX

const String FONTCONFIG_LIB = "libfontconfig.so";
static bool IsFontconfigAvailable { get; private set; } = true;
static bool IsFontconfigAvailable { get; private set; }

[AlwaysInclude, StaticInitPriority(100)]
private static class FontconfigAllowFail
{
static this()
{
SelfOuter.IsFontconfigAvailable = true;
Runtime.AddErrorHandler(new (stage, error) => {
if (stage == .PreFail)
{
Expand Down
6 changes: 3 additions & 3 deletions BeefLibs/corlib/src/IO/FileDialog.bf
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,9 @@ enum DialogResult

abstract class CommonDialog
{
protected Linux.DBus* mBus ~ Linux.SdBusUnref(_);
protected Linux.DBusMsg* mRequest ~ Linux.SdBusMessageUnref(_);
protected Linux.DBusErr mError ~ Linux.SdBusErrorFree(&_);
protected Linux.DBus* mBus ~ if (_ != null) Linux.SdBusUnref(_);
protected Linux.DBusMsg* mRequest ~ if (_ != null) Linux.SdBusMessageUnref(_);
protected Linux.DBusErr mError ~ if (_ != default) Linux.SdBusErrorFree(&_);
protected String mTitle ~ delete _;
protected String mInitialDir ~ delete _;
protected String[] mFileNames ~ DeleteContainerAndItems!(_);
Expand Down
26 changes: 12 additions & 14 deletions BeefLibs/corlib/src/Linux.bf
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,28 @@ class Linux

public typealias DBusMsgHandler = function int32(DBusMsg *m, void *userdata, DBusErr *ret_error);

public static bool IsSystemdAvailable { get; private set; } = true;
public static bool IsSystemdAvailable { get; private set; }

[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)
IsSystemdAvailable = true;
Runtime.AddErrorHandler(new (stage, error) => {
if (stage == .PreFail)
{
if (loadLibaryError.mPath == "libsystemd.so")
if (var loadLibaryError = error as Runtime.LoadSharedLibraryError)
{
IsSystemdAvailable = false;
return .Ignore;
if (loadLibaryError.mPath == "libsystemd.so")
{
IsSystemdAvailable = false;
return .Ignore;
}
}
}
}
return .ContinueFailure;
return .ContinueFailure;
});
}
}

Expand Down
Loading