unitysetup.powershell icon indicating copy to clipboard operation
unitysetup.powershell copied to clipboard

$env:UNITY_SETUP_INSTANCE_DEFAULT_BASEPATH should be either a string of comma separated values, or an array of strings

Open ryan-beesley opened this issue 2 years ago • 0 comments

The idiomatic PowerShell way to pass more than one string, would be to create a String[] and pass that in as an argument. Allowing the $env:UNITY_SETUP_INSTANCE_DEFAULT_BASEPATH environment variable to also support a PowerShell String[] allows you to create the environment variable from within a shell or as part of the $PROFILE. As a string of comma separated values, it still has value when defined externally, like in Windows environment variables, where it isn't possible to define the String[] as a PowerShell object. Outside that case, a string array is easier to manage in a PowerShellesque way.

As an example, $env:UNITY_SETUP_INSTANCE_DEFAULT_BASEPATH = @('C:\Program Files*\Unity*', 'C:\Program Files\Unity\Hub\Editor\*') and $env:UNITY_SETUP_INSTANCE_DEFAULT_BASEPATH = "C:\Program Files*\Unity*, C:\Program Files\Unity\Hub\Editor\*" should be processed the same way by unitysetup.powershell. The first when defined from a PowerShell session or script, and the second when defined as a System or User environment variable.

Both have their merits.

ryan-beesley avatar Mar 02 '23 00:03 ryan-beesley