Skip to content

Commit 9e35828

Browse files
committed
[Win] Fix CompleteInstall not returning the right path to the installed Unity exe
1 parent 75307d5 commit 9e35828

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sttz.InstallUnity/Installer/Platforms/WindowsPlatform.cs

100644100755
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,15 @@ public Task<Installation> CompleteInstall(bool aborted, CancellationToken cancel
9797

9898
if (!aborted)
9999
{
100-
var executable = Path.Combine(installationPaths, "Editor", "Unity.exe");
100+
var executable = Path.Combine(installPath, "Editor", "Unity.exe");
101101
if (!File.Exists(executable))
102-
throw new Exception($"Unity exe not found at expected path after installation: {executable}");
102+
throw new Exception($"Unity exe not found at expected path after installation: {installPath}");
103103

104104
var installation = new Installation()
105105
{
106106
version = installing.version,
107107
executable = executable,
108-
path = installationPaths
108+
path = installPath
109109
};
110110

111111
installing = default;
@@ -169,7 +169,6 @@ public async Task Install(UnityInstaller.Queue queue, UnityInstaller.QueueItem i
169169
throw new InvalidOperationException("Cannot install package without installing editor first.");
170170
}
171171

172-
var installPath = GetInstallationPath(installing.version, installationPaths);
173172
var result = await RunAsAdmin(item.filePath, $"/S /D={installPath}");
174173
if (result.exitCode != 0)
175174
{
@@ -194,7 +193,6 @@ public async Task PrepareInstall(UnityInstaller.Queue queue, string installation
194193
throw new InvalidOperationException($"Already installing another version: {installing.version}");
195194

196195
installing = queue.metadata;
197-
this.installationPaths = installationPaths;
198196
installedEditor = false;
199197

200198
// Check for upgrading installation
@@ -209,6 +207,8 @@ public async Task PrepareInstall(UnityInstaller.Queue queue, string installation
209207

210208
installedEditor = true;
211209
}
210+
211+
installPath = GetInstallationPath(installing.version, installationPaths);
212212
}
213213

214214
public Task<bool> PromptForPasswordIfNecessary(CancellationToken cancellation = default)
@@ -280,7 +280,7 @@ public async Task Uninstall(Installation installation, CancellationToken cancell
280280
Configuration configuration;
281281

282282
VersionMetadata installing;
283-
string installationPaths;
283+
string installPath;
284284
bool installedEditor;
285285

286286
async Task<(int exitCode, string output, string error)> RunAsAdmin(string filename, string arguments)

0 commit comments

Comments
 (0)