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) <noreply@anthropic.com>
This commit is contained in:
Administrator 2026-03-16 10:41:31 +01:00
parent 2b4fab9e46
commit 82c6c2dce9

View File

@ -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 {