Skip to content

Commit

Permalink
Fix symbolic link creation for persist folder on different drive
Browse files Browse the repository at this point in the history
  • Loading branch information
chaerun committed Dec 18, 2024
1 parent 859d1db commit e81e599
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,12 @@ function persist_data($manifest, $original_dir, $persist_dir) {
attrib $source +R /L
} else {
# target is a file, create hard link
New-Item -Path $source -ItemType HardLink -Value $target | Out-Null
try {
New-Item -Path $source -ItemType HardLink -Value $target | Out-Null
} catch {
warn "Failed to create HardLink for $source. Falling back to SymbolicLink."
New-Item -Path $source -ItemType SymbolicLink -Value $target | Out-Null
}
}
}
}
Expand Down Expand Up @@ -1121,7 +1126,7 @@ function test_running_process($app, $global) {
function New-DirectoryJunction($source, $target) {
# test if this script is being executed inside a docker container
if (Get-Service -Name cexecsvc -ErrorAction SilentlyContinue) {
cmd.exe /d /c "mklink /j `"$source`" `"$target`""
cmd.exe /d /c "mklink /j `"$source`" `"$target`""
} else {
New-Item -Path $source -ItemType Junction -Value $target
}
Expand Down

0 comments on commit e81e599

Please sign in to comment.