Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions pkgm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,14 @@ async function mirror_directory(dst: string, src: string, prefix: string) {
if (existsSync(targetPath)) {
await Deno.remove(targetPath);
}
// Create a hard link for files
await Deno.link(sourcePath, targetPath);
try {
// Create a hard link for files
await Deno.link(sourcePath, targetPath);
} catch {
// Fall back to a regular copy if hard linking fails (it is pretty typical
// for Linux distributions to setup home directories on a separate volume).
await Deno.copyFile(sourcePath, targetPath);
}
} else if (fileInfo.isSymlink) {
// Recreate symlink in the target directory
const linkTarget = await Deno.readLink(sourcePath);
Expand Down