Skip to content

Windows support #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: next
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ bin
obj
.vscode
Releases
/.vs
3 changes: 2 additions & 1 deletion Command/Command.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net472</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<RuntimeIdentifiers>win-x64;osx-x64</RuntimeIdentifiers>
<LangVersion>7.1</LangVersion>
<PublishSingleFile>true</PublishSingleFile>
<PublishReadyToRun>true</PublishReadyToRun>
Expand Down
8 changes: 7 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A command-line utility to install any recent version of Unity.

Currently only supports macOS (Intel & Apple Silicon) but support for Windows/Linux is possible, PRs welcome.
Currently only supports macOS (Intel & Apple Silicon) and Windows, but support for Linux is possible, PRs welcome.

## Table of Contents

Expand All @@ -25,6 +25,12 @@ Installing the latest release version of Unity is as simple as:

install-unity install f

# How to build plugin on Windows

```shell
dotnet publish -r win-x64 -c Release --self-contained --framework net6.0
```

## Versions

Most commands take a version as input, either to select the version to install or to filter the output.
Expand Down
3 changes: 2 additions & 1 deletion Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0</TargetFrameworks>
<RuntimeIdentifiers>win-x64;osx-x64</RuntimeIdentifiers>
<LangVersion>7.1</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
4 changes: 4 additions & 0 deletions sttz.InstallUnity/Installer/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public class Configuration
+ "/Applications/Unity {major}.{minor}.{patch}{type}{build};"
+ "/Applications/Unity {major}.{minor}.{patch}{type}{build} ({hash})";


[Description("Windows installation paths, separted by ; (first non-existing will be used, variables: {major} {minor} {patch} {type} {build} {hash}).")]
public string installPathWindows = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Unity\\Hub\\Editor\\{major}.{minor}.{patch}{type}{build};";

// -------- Serialization --------

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion sttz.InstallUnity/Installer/IInstallerPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public interface IInstallerPlatform
/// <summary>
/// Uninstall a Unity installation.
/// </summary>
Task Uninstall(Installation instalation, CancellationToken cancellation = default);
Task Uninstall(Installation installation, CancellationToken cancellation = default);

/// <summary>
/// Run a Unity installation with the given arguments.
Expand Down
13 changes: 2 additions & 11 deletions sttz.InstallUnity/Installer/Platforms/MacPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,7 @@ public async Task Run(Installation installation, IEnumerable<string> arguments,
Logger.LogInformation($"$ {cmd.StartInfo.FileName} {cmd.StartInfo.Arguments}");

cmd.Start();

while (!cmd.HasExited) {
await Task.Delay(100);
}
await cmd.WaitForExitAsync();

} else {
if (!arguments.Contains("-logFile")) {
Expand Down Expand Up @@ -349,12 +346,7 @@ public async Task Run(Installation installation, IEnumerable<string> arguments,
cmd.Start();
cmd.BeginOutputReadLine();
cmd.BeginErrorReadLine();

while (!cmd.HasExited) {
await Task.Delay(100);
}

cmd.WaitForExit(); // Let stdout and stderr flush
await cmd.WaitForExitAsync(); // Let stdout and stderr flush
Logger.LogInformation($"Unity exited with code {cmd.ExitCode}");
Environment.Exit(cmd.ExitCode);
}
Expand Down Expand Up @@ -697,5 +689,4 @@ async Task<bool> CheckIsRoot(bool withSudo, CancellationToken cancellation)
}
}
}

}
Loading