From 82c6c2dce98234e78854013c738aaf6ac8787c10 Mon Sep 17 00:00:00 2001 From: Administrator Date: Mon, 16 Mar 2026 10:41:31 +0100 Subject: [PATCH] fix: JD backup import crash when running as EXE $MyInvocation.MyCommand.Path is NULL in ps2exe compiled scripts, causing Split-Path/Join-Path/Test-Path to throw errors. Now checks for NULL before using the path and falls through to Gitea download. Co-Authored-By: Claude Opus 4.6 (1M context) --- VServerSetup.ps1 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/VServerSetup.ps1 b/VServerSetup.ps1 index 61400d2..35a63cb 100644 --- a/VServerSetup.ps1 +++ b/VServerSetup.ps1 @@ -358,9 +358,13 @@ if ($jdPath) { Write-Host " Importiere JD2-Backup..." -ForegroundColor Cyan Write-Host " Ziel: $jdPath" -ForegroundColor Gray # Backup zuerst lokal suchen, dann von Gitea laden - $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path - $backupZip = Join-Path $scriptDir "jdownloader-backup.zip" - if (-not (Test-Path $backupZip)) { + $backupZip = $null + $scriptPath = $MyInvocation.MyCommand.Path + if ($scriptPath) { + $localZip = Join-Path (Split-Path -Parent $scriptPath) "jdownloader-backup.zip" + if (Test-Path $localZip) { $backupZip = $localZip } + } + if (-not $backupZip) { Write-Host " Lade Backup von Gitea..." -ForegroundColor Gray $backupZip = "$tempDir\jdownloader-backup.zip" try {