Skip to content

Commit

Permalink
Fixed operating system check
Browse files Browse the repository at this point in the history
  • Loading branch information
evilfactory committed Aug 30, 2024
1 parent c907a01 commit 78465c5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 25 deletions.
16 changes: 0 additions & 16 deletions Luatrauma.AutoUpdater/Luatrauma.AutoUpdater.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,5 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
</PropertyGroup>

<PropertyGroup Condition="'$(IsWindows)'=='true'">
<DefineConstants>WINDOWS</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(IsOSX)'=='true'">
<DefineConstants>OSX</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(IsLinux)'=='true'">
<DefineConstants>LINUX</DefineConstants>
</PropertyGroup>
</Project>
28 changes: 19 additions & 9 deletions Luatrauma.AutoUpdater/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,25 @@ static class Updater

public async static Task Update()
{
string patchUrl;

#if WINDOWS
patchUrl = "https://github.com/evilfactory/LuaCsForBarotrauma/releases/download/latest/luacsforbarotrauma_patch_windows_client.zip";
#elif LINUX
patchUrl = "https://github.com/evilfactory/LuaCsForBarotrauma/releases/download/latest/luacsforbarotrauma_patch_linux_client.zip";
#elif MACOS
patchUrl = "https://github.com/evilfactory/LuaCsForBarotrauma/releases/download/latest/luacsforbarotrauma_patch_mac_client.zip;
#endif
string patchUrl = null;

Check warning on line 17 in Luatrauma.AutoUpdater/Updater.cs

View workflow job for this annotation

GitHub Actions / publish-release / build / build

Converting null literal or possible null value to non-nullable type.

Check warning on line 17 in Luatrauma.AutoUpdater/Updater.cs

View workflow job for this annotation

GitHub Actions / publish-release / build / build

Converting null literal or possible null value to non-nullable type.

Check warning on line 17 in Luatrauma.AutoUpdater/Updater.cs

View workflow job for this annotation

GitHub Actions / publish-release / build / build

Converting null literal or possible null value to non-nullable type.
if (OperatingSystem.IsWindows())
{
patchUrl = "https://github.com/evilfactory/LuaCsForBarotrauma/releases/download/latest/luacsforbarotrauma_patch_windows_client.zip";
}
else if (OperatingSystem.IsLinux())
{
patchUrl = "https://github.com/evilfactory/LuaCsForBarotrauma/releases/download/latest/luacsforbarotrauma_patch_linux_client.zip";
}
else if (OperatingSystem.IsMacOS())
{
patchUrl = "https://github.com/evilfactory/LuaCsForBarotrauma/releases/download/latest/luacsforbarotrauma_patch_mac_client.zip";
}

if (patchUrl == null)
{
Console.WriteLine("Unsupported operating system.");
return;
}

string tempFolder = Path.Combine(Directory.GetCurrentDirectory(), TempFolder);
string patchZip = Path.Combine(tempFolder, "patch.zip");
Expand Down

0 comments on commit 78465c5

Please sign in to comment.