diff options
| author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2024-01-29 19:58:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-29 19:58:18 +0100 |
| commit | 70fcba39de34fc211d09da12783898161724b0dc (patch) | |
| tree | 9efdf7c191694e95de149129c9032b129527cb32 /src/Ryujinx.Common/ReleaseInformation.cs | |
| parent | 7795b662a9b6054343195db9fc221a920509c1be (diff) | |
Make config filename changable for releases & Log to Ryujinx directory if application directory is not writable (#4707)
* Remove GetBaseApplicationDirectory() & Move logs directory to user base path
We should assume the application directory might be write-protected.
* Use Ryujinx.sh in Ryujinx.desktop
This desktop file isn't really used right now,
so this changes effectively nothing.
* Use properties in ReleaseInformation.cs and add ConfigName property
* Configure config filename in Github workflows
* Add a separate config step for macOS
Because they use BSD sed instead of GNU sed
* Keep log directory at the old location for dev environments
* Add FileSystemUtils since Directory.Move() doesn't work across filesystems
Steal CopyDirectory code from https://learn.microsoft.com/en-us/dotnet/standard/io/how-to-copy-directories
* Fix "Open Logs folder" button pointing to the wrong directory
* Add execute permissions to Ryujinx.sh
* Fix missing newlines
* AppDataManager: Use FileSystemUtils.MoveDirectory()
* Make dotnet format happy
* Add a fallback for the logging directory
Diffstat (limited to 'src/Ryujinx.Common/ReleaseInformation.cs')
| -rw-r--r-- | src/Ryujinx.Common/ReleaseInformation.cs | 55 |
1 files changed, 14 insertions, 41 deletions
diff --git a/src/Ryujinx.Common/ReleaseInformation.cs b/src/Ryujinx.Common/ReleaseInformation.cs index ab65a98f..774ae012 100644 --- a/src/Ryujinx.Common/ReleaseInformation.cs +++ b/src/Ryujinx.Common/ReleaseInformation.cs @@ -1,5 +1,3 @@ -using Ryujinx.Common.Configuration; -using System; using System.Reflection; namespace Ryujinx.Common @@ -9,50 +7,25 @@ namespace Ryujinx.Common { private const string FlatHubChannelOwner = "flathub"; - public const string BuildVersion = "%%RYUJINX_BUILD_VERSION%%"; - public const string BuildGitHash = "%%RYUJINX_BUILD_GIT_HASH%%"; - public const string ReleaseChannelName = "%%RYUJINX_TARGET_RELEASE_CHANNEL_NAME%%"; + private const string BuildVersion = "%%RYUJINX_BUILD_VERSION%%"; + private const string BuildGitHash = "%%RYUJINX_BUILD_GIT_HASH%%"; + private const string ReleaseChannelName = "%%RYUJINX_TARGET_RELEASE_CHANNEL_NAME%%"; + private const string ConfigFileName = "%%RYUJINX_CONFIG_FILE_NAME%%"; + public const string ReleaseChannelOwner = "%%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER%%"; public const 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; - } + public static string ConfigName => !ConfigFileName.StartsWith("%%") ? ConfigFileName : "Config.json"; - return Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion; - } + public static bool IsValid => + !BuildGitHash.StartsWith("%%") && + !ReleaseChannelName.StartsWith("%%") && + !ReleaseChannelOwner.StartsWith("%%") && + !ReleaseChannelRepo.StartsWith("%%") && + !ConfigFileName.StartsWith("%%"); -#if FORCE_EXTERNAL_BASE_DIR - public static string GetBaseApplicationDirectory() - { - return AppDataManager.BaseDirPath; - } -#else - public static string GetBaseApplicationDirectory() - { - if (IsFlatHubBuild() || OperatingSystem.IsMacOS()) - { - return AppDataManager.BaseDirPath; - } + public static bool IsFlatHubBuild => IsValid && ReleaseChannelOwner.Equals(FlatHubChannelOwner); - return AppDomain.CurrentDomain.BaseDirectory; - } -#endif + public static string Version => IsValid ? BuildVersion : Assembly.GetEntryAssembly()!.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion; } } |
