Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit 146d34a

Browse files
author
Jamie Brynes
authored
Fix MacOS local launch errors when there are spaces in paths (#1442)
1 parent b75637d commit 146d34a

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
## Unreleased
44

5+
### Added
6+
7+
- Added capability to test commands through the `MockConnectionHandler`. [#1437](https://github.com/spatialos/gdk-for-unity/pull/1437)
8+
59
### Fixed
610

711
- Fixed an `IndexOutOfRangeException` that could be thrown when editing your 'Build Configuration' asset. [#1441](https://github.com/spatialos/gdk-for-unity/pull/1441)
812
- The 'Build Configuration' Inspector window will no longer report your Android SDK installation as missing if you have a completely fresh Unity installation with the bundled Android SDK. [#1441](https://github.com/spatialos/gdk-for-unity/pull/1441)
9-
10-
### Added
11-
12-
- Added capability to test commands through the `MockConnectionHandler`. [#1437](https://github.com/spatialos/gdk-for-unity/pull/1437)
13+
- Fixed a bug where having spaces in the path to your project would cause the 'Local launch' and 'Launch standalone client' menu options to fail on MacOS. [#1442](https://github.com/spatialos/gdk-for-unity/pull/1442)
1314

1415
### Internal
1516

workers/unity/Packages/io.improbable.gdk.tools/LocalLaunch.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ public static void LaunchClient()
9191
{
9292
command = "osascript";
9393
commandArgs = $@"-e 'tell application ""Terminal""
94+
set projectDir to ""{Common.SpatialProjectRootDir}""
9495
activate
95-
do script ""cd {Common.SpatialProjectRootDir} && {Common.SpatialBinary} {commandArgs}""
96+
do script ""cd "" & quoted form of projectDir & "" && {Common.SpatialBinary} {commandArgs}""
9697
end tell'";
9798
unityClientZipName = "[email protected]";
9899
}
@@ -221,7 +222,7 @@ public static void LaunchLocalDeployment()
221222
var command = Common.SpatialBinary;
222223

223224
#if UNITY_EDITOR_OSX
224-
var commandArgs = $"local launch --enable_pre_run_check=false --snapshot '{toolsConfig.CustomSnapshotPath}' --experimental_runtime={toolsConfig.RuntimeVersion}";
225+
var commandArgs = $"local launch --enable_pre_run_check=false --experimental_runtime={toolsConfig.RuntimeVersion}";
225226
#else
226227
var commandArgs = $"local launch --enable_pre_run_check=false --snapshot \"{toolsConfig.CustomSnapshotPath}\" --experimental_runtime={toolsConfig.RuntimeVersion}";
227228
#endif
@@ -237,15 +238,17 @@ public static void LaunchLocalDeployment()
237238
command = "osascript";
238239
commandArgs = $@"-e 'tell application ""Terminal""
239240
activate
240-
do script ""cd {Common.SpatialProjectRootDir} && {Common.SpatialBinary} {commandArgs}""
241+
set projectDir to ""{Common.SpatialProjectRootDir}""
242+
set snapshotPath to ""{toolsConfig.CustomSnapshotPath}""
243+
do script ""cd "" & quoted form of projectDir & "" && {Common.SpatialBinary} {commandArgs} --snapshot "" & quoted form of snapshotPath
241244
end tell'";
242245
}
243246

244247
var processInfo = new ProcessStartInfo(command, commandArgs)
245248
{
246249
CreateNoWindow = false,
247250
UseShellExecute = true,
248-
WorkingDirectory = Common.SpatialProjectRootDir
251+
WorkingDirectory = Common.SpatialProjectRootDir,
249252
};
250253

251254
var process = Process.Start(processInfo);

0 commit comments

Comments
 (0)