Skip to content

Commit 5dbb353

Browse files
committed
better windows detection
1 parent 8fb8366 commit 5dbb353

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

install.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
$InWindows = [System.Environment]::OSVersion.Platform -eq 'Win32NT'
19+
1820
$SUFFIX = "_windows_amd64"
1921
$EXT = ".zip"
2022
$CMD = "ops.exe"
2123

22-
if (-not $IsWindows) {
24+
if (-not $InWindows) {
2325
$OS = (uname -s)
2426
$ARCH = (uname -m)
2527
$CMD = "ops"
@@ -77,7 +79,7 @@ if (-not (Test-Path "$BinPath/$CMD*")) {
7779

7880
# Check if the bin path is in the user's PATH
7981
if (-not ($env:PATH -contains $BinPath)) {
80-
if($IsWindows) {
82+
if($InWindows) {
8183
$existingPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::User)
8284
$newPath = "$BinPath;$existingPath"
8385
[System.Environment]::SetEnvironmentVariable("Path", $newPath, [System.EnvironmentVariableTarget]::User)

0 commit comments

Comments
 (0)