mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-08 11:48:34 +00:00
1f1e2a7f03
This allows changing base application directory behavior at build time via FORCE_EXTERNAL_BASE_DIR. This is intended to be used by nixpkgs and flathub builds. I also added the missing patch for macOS that we have on macos1 to avoid invalidating code signature.
60 lines
1.9 KiB
C#
60 lines
1.9 KiB
C#
using Ryujinx.Common.Configuration;
|
|
using System;
|
|
using System.Reflection;
|
|
|
|
namespace Ryujinx.Common
|
|
{
|
|
// DO NOT EDIT, filled by CI
|
|
public static class ReleaseInformation
|
|
{
|
|
private const string FlatHubChannelOwner = "flathub";
|
|
|
|
public static string BuildVersion = "%%RYUJINX_BUILD_VERSION%%";
|
|
public static string BuildGitHash = "%%RYUJINX_BUILD_GIT_HASH%%";
|
|
public static string ReleaseChannelName = "%%RYUJINX_TARGET_RELEASE_CHANNEL_NAME%%";
|
|
public static string ReleaseChannelOwner = "%%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER%%";
|
|
public static string ReleaseChannelRepo = "%%RYUJINX_TARGET_RELEASE_CHANNEL_REPO%%";
|
|
|
|
public static bool IsValid()
|
|
{
|
|
return !BuildGitHash.StartsWith("%%") &&
|
|
!ReleaseChannelName.StartsWith("%%") &&
|
|
!ReleaseChannelOwner.StartsWith("%%") &&
|
|
!ReleaseChannelRepo.StartsWith("%%");
|
|
}
|
|
|
|
public static bool IsFlatHubBuild()
|
|
{
|
|
return IsValid() && ReleaseChannelOwner.Equals(FlatHubChannelOwner);
|
|
}
|
|
|
|
public static string GetVersion()
|
|
{
|
|
if (IsValid())
|
|
{
|
|
return BuildVersion;
|
|
}
|
|
else
|
|
{
|
|
return Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
|
}
|
|
}
|
|
|
|
#if FORCE_EXTERNAL_BASE_DIR
|
|
public static string GetBaseApplicationDirectory()
|
|
{
|
|
return AppDataManager.BaseDirPath;
|
|
}
|
|
#else
|
|
public static string GetBaseApplicationDirectory()
|
|
{
|
|
if (IsFlatHubBuild() || OperatingSystem.IsMacOS())
|
|
{
|
|
return AppDataManager.BaseDirPath;
|
|
}
|
|
|
|
return AppDomain.CurrentDomain.BaseDirectory;
|
|
}
|
|
#endif
|
|
}
|
|
} |