From c19f403eca2f51d6c4181865faa12ba31692e119 Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 06:40:16 +0200 Subject: [PATCH 01/22] try on pwsh --- .github/workflows/pester.yml | 58 ++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/pester.yml b/.github/workflows/pester.yml index ef3e14e..1298d17 100644 --- a/.github/workflows/pester.yml +++ b/.github/workflows/pester.yml @@ -1,33 +1,33 @@ name: Pester on: [push, pull_request, workflow_dispatch] jobs: - # test-pwsh: - # strategy: - # matrix: - # platform: [ubuntu-latest, macos-latest, windows-latest] - # runs-on: ${{ matrix.platform }} - # steps: - # - uses: actions/checkout@v4 - # - name: Run Pester tests (pwsh) - # run: | - # Write-host $PSVersionTable.PSVersion.Major $PSVersionTable.PSRemotingProtocolVersion.Minor - # Install-Module -Name Pester -RequiredVersion 5.2.2 -Confirm:$false -Force - # Set-Location -Path .\Tests\ - # Invoke-Pester - # if ($Error[0].Fullyqualifiederrorid -eq 'PesterAssertionFailed') {exit 1} - # shell: pwsh + test-pwsh: + strategy: + matrix: + platform: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v4 + - name: Run Pester tests (pwsh) + run: | + Write-host $PSVersionTable.PSVersion.Major $PSVersionTable.PSRemotingProtocolVersion.Minor + Install-Module -Name Pester -RequiredVersion 5.2.2 -Confirm:$false -Force + Set-Location -Path .\Tests\ + Invoke-Pester + if ($Error[0].Fullyqualifiederrorid -eq 'PesterAssertionFailed') {exit 1} + shell: pwsh - test-posh: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - name: Run Pester tests (PowerShell) - run: | - Write-host $PSVersionTable.PSVersion.Major $PSVersionTable.PSRemotingProtocolVersion.Minor - Install-Module -Name Pester -RequiredVersion 5.6.1 -Confirm:$false -Force - $pesterConfig = New-PesterConfiguration - $pesterConfig.CodeCoverage.Enabled = $true - Set-Location -Path .\Tests\ - Invoke-Pester -Configuration $pesterConfig - if ($Error[0].Fullyqualifiederrorid -eq 'PesterAssertionFailed') {exit 1} - shell: powershell + test-posh: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: Run Pester tests (PowerShell) + run: | + Write-host $PSVersionTable.PSVersion.Major $PSVersionTable.PSRemotingProtocolVersion.Minor + Install-Module -Name Pester -RequiredVersion 5.6.1 -Confirm:$false -Force + $pesterConfig = New-PesterConfiguration + $pesterConfig.CodeCoverage.Enabled = $true + Set-Location -Path .\Tests\ + Invoke-Pester -Configuration $pesterConfig + if ($Error[0].Fullyqualifiederrorid -eq 'PesterAssertionFailed') {exit 1} + shell: powershell From 9bdb71bffb4b281dbc5bd9b2ba8dfc7f69e92175 Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 06:43:48 +0200 Subject: [PATCH 02/22] update pester version --- .github/workflows/pester.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pester.yml b/.github/workflows/pester.yml index 1298d17..08daeda 100644 --- a/.github/workflows/pester.yml +++ b/.github/workflows/pester.yml @@ -11,7 +11,7 @@ jobs: - name: Run Pester tests (pwsh) run: | Write-host $PSVersionTable.PSVersion.Major $PSVersionTable.PSRemotingProtocolVersion.Minor - Install-Module -Name Pester -RequiredVersion 5.2.2 -Confirm:$false -Force + Install-Module -Name Pester -RequiredVersion 5.6.1 -Confirm:$false -Force Set-Location -Path .\Tests\ Invoke-Pester if ($Error[0].Fullyqualifiederrorid -eq 'PesterAssertionFailed') {exit 1} From 50aaa8a9c00874507b7909a5f0f3acceba7fd93f Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 06:50:57 +0200 Subject: [PATCH 03/22] try without mac os --- .github/workflows/pester.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pester.yml b/.github/workflows/pester.yml index 08daeda..fb3aeae 100644 --- a/.github/workflows/pester.yml +++ b/.github/workflows/pester.yml @@ -4,7 +4,7 @@ jobs: test-pwsh: strategy: matrix: - platform: [ubuntu-latest, macos-latest, windows-latest] + platform: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.platform }} steps: - uses: actions/checkout@v4 From 5347ae785ec9ff27b0e4fe7339411633176f9463 Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 07:57:13 +0200 Subject: [PATCH 04/22] try using my own random files --- Tests/TestUtils.ps1 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Tests/TestUtils.ps1 b/Tests/TestUtils.ps1 index 9c1bcb4..54c6e6b 100644 --- a/Tests/TestUtils.ps1 +++ b/Tests/TestUtils.ps1 @@ -18,8 +18,10 @@ function Mock-Api-Call-Grails-1.1.1-Available($Available) { function Mock-PSDK-Dir { $Script:backup_PSDK_DIR = $Global:PSDK_DIR - New-Item -ItemType Directory "TestDrive:.posh-sdk" | Out-Null - $Global:PSDK_DIR = (Get-Item "TestDrive:.posh-sdk").FullName + $randomName = (-join ((65..90) + (97..122) | Get-Random -Count 5 | % {[char]$_})) + $testPath = "$env:Temp/$randomName" + New-Item -ItemType Directory "$testPath/.posh-sdk" | Out-Null + $Global:PSDK_DIR = (Get-Item "$testPath/.posh-sdk").FullName New-Item -ItemType Directory "$Global:PSDK_DIR\grails" | Out-Null } @@ -54,4 +56,4 @@ function Mock-Dispatcher-Test([switch]$Offline) { function Reset-Dispatcher-Test { Reset-PSDK-Dir -} \ No newline at end of file +} From d00af9f395a467ffe6303c09a73d9e535b010b27 Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 08:24:04 +0200 Subject: [PATCH 05/22] use backslash --- Tests/TestUtils.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/TestUtils.ps1 b/Tests/TestUtils.ps1 index 54c6e6b..9089fff 100644 --- a/Tests/TestUtils.ps1 +++ b/Tests/TestUtils.ps1 @@ -19,9 +19,9 @@ function Mock-Api-Call-Grails-1.1.1-Available($Available) { function Mock-PSDK-Dir { $Script:backup_PSDK_DIR = $Global:PSDK_DIR $randomName = (-join ((65..90) + (97..122) | Get-Random -Count 5 | % {[char]$_})) - $testPath = "$env:Temp/$randomName" - New-Item -ItemType Directory "$testPath/.posh-sdk" | Out-Null - $Global:PSDK_DIR = (Get-Item "$testPath/.posh-sdk").FullName + $testPath = "$env:Temp\$randomName" + New-Item -ItemType Directory "$testPath\.posh-sdk" | Out-Null + $Global:PSDK_DIR = (Get-Item "$testPath\.posh-sdk").FullName New-Item -ItemType Directory "$Global:PSDK_DIR\grails" | Out-Null } From 619041efdbf99692c28f3ff9d8115c7293b497df Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 08:30:55 +0200 Subject: [PATCH 06/22] debug env --- .github/workflows/pester.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pester.yml b/.github/workflows/pester.yml index fb3aeae..b1e1c8c 100644 --- a/.github/workflows/pester.yml +++ b/.github/workflows/pester.yml @@ -4,12 +4,14 @@ jobs: test-pwsh: strategy: matrix: - platform: [ubuntu-latest, windows-latest] + platform: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.platform }} steps: - uses: actions/checkout@v4 - name: Run Pester tests (pwsh) run: | + Write-host $env + Write-host $env:Temp Write-host $PSVersionTable.PSVersion.Major $PSVersionTable.PSRemotingProtocolVersion.Minor Install-Module -Name Pester -RequiredVersion 5.6.1 -Confirm:$false -Force Set-Location -Path .\Tests\ From 63513def6ba888a82b945037350304dd12e44831 Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 08:36:14 +0200 Subject: [PATCH 07/22] use .net method to get temp path --- Tests/TestUtils.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/TestUtils.ps1 b/Tests/TestUtils.ps1 index 9089fff..d25b8d2 100644 --- a/Tests/TestUtils.ps1 +++ b/Tests/TestUtils.ps1 @@ -19,7 +19,8 @@ function Mock-Api-Call-Grails-1.1.1-Available($Available) { function Mock-PSDK-Dir { $Script:backup_PSDK_DIR = $Global:PSDK_DIR $randomName = (-join ((65..90) + (97..122) | Get-Random -Count 5 | % {[char]$_})) - $testPath = "$env:Temp\$randomName" + $tempDir = [System.IO.Path]::GetTempPath() + $testPath = "$tempDir\$randomName" New-Item -ItemType Directory "$testPath\.posh-sdk" | Out-Null $Global:PSDK_DIR = (Get-Item "$testPath\.posh-sdk").FullName New-Item -ItemType Directory "$Global:PSDK_DIR\grails" | Out-Null From 33024fd6a9835202344603ce9a04f238bd6199ad Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 08:45:52 +0200 Subject: [PATCH 08/22] debug folder creation --- Tests/TestUtils.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/TestUtils.ps1 b/Tests/TestUtils.ps1 index d25b8d2..2a751ea 100644 --- a/Tests/TestUtils.ps1 +++ b/Tests/TestUtils.ps1 @@ -21,7 +21,7 @@ function Mock-PSDK-Dir { $randomName = (-join ((65..90) + (97..122) | Get-Random -Count 5 | % {[char]$_})) $tempDir = [System.IO.Path]::GetTempPath() $testPath = "$tempDir\$randomName" - New-Item -ItemType Directory "$testPath\.posh-sdk" | Out-Null + New-Item -ItemType Directory "$testPath\.posh-sdk" $Global:PSDK_DIR = (Get-Item "$testPath\.posh-sdk").FullName New-Item -ItemType Directory "$Global:PSDK_DIR\grails" | Out-Null } From 918810328af15e09e0e2f74af86e92f439dd64a3 Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 09:50:33 +0200 Subject: [PATCH 09/22] need -Force for hidden folders --- Tests/TestUtils.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/TestUtils.ps1 b/Tests/TestUtils.ps1 index 2a751ea..bdb6489 100644 --- a/Tests/TestUtils.ps1 +++ b/Tests/TestUtils.ps1 @@ -22,7 +22,7 @@ function Mock-PSDK-Dir { $tempDir = [System.IO.Path]::GetTempPath() $testPath = "$tempDir\$randomName" New-Item -ItemType Directory "$testPath\.posh-sdk" - $Global:PSDK_DIR = (Get-Item "$testPath\.posh-sdk").FullName + $Global:PSDK_DIR = (Get-Item "$testPath\.posh-sdk" -Force).FullName New-Item -ItemType Directory "$Global:PSDK_DIR\grails" | Out-Null } From 87e16e03af8da9f5d2e498ea77ad00185a7324d9 Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 09:53:56 +0200 Subject: [PATCH 10/22] do not fail fast --- .github/workflows/pester.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pester.yml b/.github/workflows/pester.yml index b1e1c8c..d8e5738 100644 --- a/.github/workflows/pester.yml +++ b/.github/workflows/pester.yml @@ -3,6 +3,7 @@ on: [push, pull_request, workflow_dispatch] jobs: test-pwsh: strategy: + fail-fast: false matrix: platform: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.platform }} From 8edfcd5b7b50203ee13adb7e94294e9bb17495cf Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 11:28:40 +0200 Subject: [PATCH 11/22] print out env --- .github/workflows/pester.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pester.yml b/.github/workflows/pester.yml index d8e5738..dbf34d0 100644 --- a/.github/workflows/pester.yml +++ b/.github/workflows/pester.yml @@ -11,8 +11,7 @@ jobs: - uses: actions/checkout@v4 - name: Run Pester tests (pwsh) run: | - Write-host $env - Write-host $env:Temp + dir env: Write-host $PSVersionTable.PSVersion.Major $PSVersionTable.PSRemotingProtocolVersion.Minor Install-Module -Name Pester -RequiredVersion 5.6.1 -Confirm:$false -Force Set-Location -Path .\Tests\ From 82ca43ea347f8fa128ae094a3fe61992da27c0fc Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 11:32:00 +0200 Subject: [PATCH 12/22] need a force delete hidden folders need -force parameter on linux/mac --- Tests/Commands.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Commands.Tests.ps1 b/Tests/Commands.Tests.ps1 index c9a9f47..87d09a5 100644 --- a/Tests/Commands.Tests.ps1 +++ b/Tests/Commands.Tests.ps1 @@ -10,7 +10,7 @@ Describe 'sdk' { BeforeAll { $Script:PSDK_FORCE_OFFLINE = $true Mock-PSDK-Dir - Remove-Item $Global:PSDK_DIR -Recurse + Remove-Item $Global:PSDK_DIR -Recurse -Force Mock Initialize-Posh-SDK -verifiable Mock Initialize-Candidate-Cache -verifiable Mock Show-Help From b493ea3b8e1f12262b880aa2e00fee11ba8fc51b Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 13:32:53 +0200 Subject: [PATCH 13/22] change get-item().delete to remove-item else the cmd.exe was used for deletion --- Tests/Utils.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Utils.Tests.ps1 b/Tests/Utils.Tests.ps1 index 72c99b2..5eb1ad6 100644 --- a/Tests/Utils.Tests.ps1 +++ b/Tests/Utils.Tests.ps1 @@ -761,7 +761,7 @@ Describe 'Set-Junction-Via-Mklink' { } AfterAll { - (Get-Item "$Global:PSDK_DIR\grails\bla").Delete() + Remove-Item -Path "$Global:PSDK_DIR\grails\bla" -Recurse Reset-PSDK-Dir } } From 3bb8952e6a1fc5511af34a42dbeae5c988d72adb Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 13:37:31 +0200 Subject: [PATCH 14/22] add a test around the link --- Tests/Utils.Tests.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tests/Utils.Tests.ps1 b/Tests/Utils.Tests.ps1 index 5eb1ad6..dee77bc 100644 --- a/Tests/Utils.Tests.ps1 +++ b/Tests/Utils.Tests.ps1 @@ -761,7 +761,9 @@ Describe 'Set-Junction-Via-Mklink' { } AfterAll { - Remove-Item -Path "$Global:PSDK_DIR\grails\bla" -Recurse + if (Test-Path "$Global:PSDK_DIR\grails\bla") { + Remove-Item -Path "$Global:PSDK_DIR\grails\bla" -Recurse + } Reset-PSDK-Dir } } From 731f971533adbf0af7c05e15944f7a57c5c51d64 Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 13:46:26 +0200 Subject: [PATCH 15/22] change handling of links on non windows platforms --- PSSDKMan/Utils.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PSSDKMan/Utils.ps1 b/PSSDKMan/Utils.ps1 index ce75b4d..94df297 100644 --- a/PSSDKMan/Utils.ps1 +++ b/PSSDKMan/Utils.ps1 @@ -287,8 +287,11 @@ function Set-Junction-Via-Mklink($Link, $Target) { if ( Test-Path $Link ) { (Get-Item $Link).Delete() } - - Invoke-Expression -Command "cmd.exe /c mklink /J '$Link' '$Target'" | Out-Null + if ($IsWindows) { + Invoke-Expression -Command "cmd.exe /c mklink /J '$Link' '$Target'" | Out-Null + } else { + Invoke-Expression -Command "ln -s '$Link' '$Target'" | Out-Null + } } function Get-Online-Mode() { From 2c801d882162d19ced5559af3e0ff58daba9cdb5 Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 13:51:58 +0200 Subject: [PATCH 16/22] can not use $isWindows --- PSSDKMan/Utils.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PSSDKMan/Utils.ps1 b/PSSDKMan/Utils.ps1 index 94df297..588a86e 100644 --- a/PSSDKMan/Utils.ps1 +++ b/PSSDKMan/Utils.ps1 @@ -287,7 +287,7 @@ function Set-Junction-Via-Mklink($Link, $Target) { if ( Test-Path $Link ) { (Get-Item $Link).Delete() } - if ($IsWindows) { + if ($PSVersionTable.Platform -eq "Win32NT") { Invoke-Expression -Command "cmd.exe /c mklink /J '$Link' '$Target'" | Out-Null } else { Invoke-Expression -Command "ln -s '$Link' '$Target'" | Out-Null From c751acbd93606704b6096f168fed8aa618fde7cf Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 13:56:01 +0200 Subject: [PATCH 17/22] use $env:OS for determining windows --- PSSDKMan/Utils.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PSSDKMan/Utils.ps1 b/PSSDKMan/Utils.ps1 index 588a86e..12876b4 100644 --- a/PSSDKMan/Utils.ps1 +++ b/PSSDKMan/Utils.ps1 @@ -287,7 +287,7 @@ function Set-Junction-Via-Mklink($Link, $Target) { if ( Test-Path $Link ) { (Get-Item $Link).Delete() } - if ($PSVersionTable.Platform -eq "Win32NT") { + if ($Env:OS -eq "Windows_NT") { Invoke-Expression -Command "cmd.exe /c mklink /J '$Link' '$Target'" | Out-Null } else { Invoke-Expression -Command "ln -s '$Link' '$Target'" | Out-Null From 7339b58d5629c987abe7859e9028bc0fe3ef79d9 Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 14:01:43 +0200 Subject: [PATCH 18/22] use force for finding hidden path --- Tests/Utils.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Utils.Tests.ps1 b/Tests/Utils.Tests.ps1 index dee77bc..b39fff0 100644 --- a/Tests/Utils.Tests.ps1 +++ b/Tests/Utils.Tests.ps1 @@ -783,7 +783,7 @@ Describe 'Get-Junction-Target' { } AfterAll { - (Get-Item "$Global:PSDK_DIR\grails\bla").Delete() + (Get-Item "$Global:PSDK_DIR\grails\bla" -Force).Delete() Reset-PSDK-Dir } } From 9bb77048d401ba061984339239cbf8589fae2b07 Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 15:23:16 +0200 Subject: [PATCH 19/22] use new-item to create symlink --- PSSDKMan/Utils.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PSSDKMan/Utils.ps1 b/PSSDKMan/Utils.ps1 index 12876b4..253ae4f 100644 --- a/PSSDKMan/Utils.ps1 +++ b/PSSDKMan/Utils.ps1 @@ -290,7 +290,7 @@ function Set-Junction-Via-Mklink($Link, $Target) { if ($Env:OS -eq "Windows_NT") { Invoke-Expression -Command "cmd.exe /c mklink /J '$Link' '$Target'" | Out-Null } else { - Invoke-Expression -Command "ln -s '$Link' '$Target'" | Out-Null + New-Item -Path $Link -ItemType SymbolicLink -Value $Target | Out-Null } } From 17145d9ebb4f03dc54e91b724cf5f193ba30c722 Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 15:26:51 +0200 Subject: [PATCH 20/22] revert old "if" change --- Tests/Utils.Tests.ps1 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Tests/Utils.Tests.ps1 b/Tests/Utils.Tests.ps1 index b39fff0..bdfd363 100644 --- a/Tests/Utils.Tests.ps1 +++ b/Tests/Utils.Tests.ps1 @@ -761,9 +761,7 @@ Describe 'Set-Junction-Via-Mklink' { } AfterAll { - if (Test-Path "$Global:PSDK_DIR\grails\bla") { - Remove-Item -Path "$Global:PSDK_DIR\grails\bla" -Recurse - } + (Get-Item "$Global:PSDK_DIR\grails\bla").Delete() Reset-PSDK-Dir } } From dedec90ac96e0570e90b010e2500e9f5acef5e5f Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 15:27:55 +0200 Subject: [PATCH 21/22] remove unused -force --- Tests/Utils.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Utils.Tests.ps1 b/Tests/Utils.Tests.ps1 index bdfd363..72c99b2 100644 --- a/Tests/Utils.Tests.ps1 +++ b/Tests/Utils.Tests.ps1 @@ -781,7 +781,7 @@ Describe 'Get-Junction-Target' { } AfterAll { - (Get-Item "$Global:PSDK_DIR\grails\bla" -Force).Delete() + (Get-Item "$Global:PSDK_DIR\grails\bla").Delete() Reset-PSDK-Dir } } From 1b77976a428b93ba17e8478960b59f19d872318b Mon Sep 17 00:00:00 2001 From: Ronny Polley Date: Wed, 9 Oct 2024 15:30:10 +0200 Subject: [PATCH 22/22] use new-item for linking --- PSSDKMan/Utils.ps1 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/PSSDKMan/Utils.ps1 b/PSSDKMan/Utils.ps1 index 253ae4f..92b04d8 100644 --- a/PSSDKMan/Utils.ps1 +++ b/PSSDKMan/Utils.ps1 @@ -287,11 +287,7 @@ function Set-Junction-Via-Mklink($Link, $Target) { if ( Test-Path $Link ) { (Get-Item $Link).Delete() } - if ($Env:OS -eq "Windows_NT") { - Invoke-Expression -Command "cmd.exe /c mklink /J '$Link' '$Target'" | Out-Null - } else { - New-Item -Path $Link -ItemType SymbolicLink -Value $Target | Out-Null - } + New-Item -Path $Link -ItemType SymbolicLink -Value $Target | Out-Null } function Get-Online-Mode() {