2023-12-04 13:17:13 +00:00
|
|
|
using Ryujinx.Common.Configuration;
|
2022-03-04 17:03:16 +00:00
|
|
|
using System;
|
|
|
|
using System.Reflection;
|
2022-01-24 17:49:14 +00:00
|
|
|
|
|
|
|
namespace Ryujinx.Common
|
2022-01-22 16:56:09 +00:00
|
|
|
{
|
|
|
|
// DO NOT EDIT, filled by CI
|
2023-01-07 08:06:13 +00:00
|
|
|
public static class ReleaseInformation
|
2022-01-22 16:56:09 +00:00
|
|
|
{
|
2022-03-04 17:03:16 +00:00
|
|
|
private const string FlatHubChannelOwner = "flathub";
|
|
|
|
|
2023-06-28 17:41:38 +01:00
|
|
|
public const string BuildVersion = "%%RYUJINX_BUILD_VERSION%%";
|
|
|
|
public const string BuildGitHash = "%%RYUJINX_BUILD_GIT_HASH%%";
|
|
|
|
public const string ReleaseChannelName = "%%RYUJINX_TARGET_RELEASE_CHANNEL_NAME%%";
|
|
|
|
public const string ReleaseChannelOwner = "%%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER%%";
|
|
|
|
public const string ReleaseChannelRepo = "%%RYUJINX_TARGET_RELEASE_CHANNEL_REPO%%";
|
2022-01-22 16:56:09 +00:00
|
|
|
|
|
|
|
public static bool IsValid()
|
|
|
|
{
|
|
|
|
return !BuildGitHash.StartsWith("%%") &&
|
|
|
|
!ReleaseChannelName.StartsWith("%%") &&
|
|
|
|
!ReleaseChannelOwner.StartsWith("%%") &&
|
|
|
|
!ReleaseChannelRepo.StartsWith("%%");
|
|
|
|
}
|
|
|
|
|
2022-03-04 17:03:16 +00:00
|
|
|
public static bool IsFlatHubBuild()
|
|
|
|
{
|
|
|
|
return IsValid() && ReleaseChannelOwner.Equals(FlatHubChannelOwner);
|
|
|
|
}
|
|
|
|
|
2022-01-22 16:56:09 +00:00
|
|
|
public static string GetVersion()
|
|
|
|
{
|
|
|
|
if (IsValid())
|
|
|
|
{
|
|
|
|
return BuildVersion;
|
|
|
|
}
|
2023-06-28 17:41:38 +01:00
|
|
|
|
|
|
|
return Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
2022-01-22 16:56:09 +00:00
|
|
|
}
|
2022-03-04 17:03:16 +00:00
|
|
|
|
2023-02-21 21:38:34 +00:00
|
|
|
#if FORCE_EXTERNAL_BASE_DIR
|
2022-03-04 17:03:16 +00:00
|
|
|
public static string GetBaseApplicationDirectory()
|
|
|
|
{
|
2023-02-21 21:38:34 +00:00
|
|
|
return AppDataManager.BaseDirPath;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
public static string GetBaseApplicationDirectory()
|
|
|
|
{
|
|
|
|
if (IsFlatHubBuild() || OperatingSystem.IsMacOS())
|
2022-03-04 17:03:16 +00:00
|
|
|
{
|
|
|
|
return AppDataManager.BaseDirPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
return AppDomain.CurrentDomain.BaseDirectory;
|
|
|
|
}
|
2023-02-21 21:38:34 +00:00
|
|
|
#endif
|
2022-01-22 16:56:09 +00:00
|
|
|
}
|
2023-06-28 17:41:38 +01:00
|
|
|
}
|