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
13 changes: 12 additions & 1 deletion pkgm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,12 +506,23 @@ function expand_runtime_env(
}

function symlink_with_overwrite(src: string, dst: string) {
if (existsSync(dst) && Deno.lstatSync(dst).isSymlink) {
if (isSymlink(dst)) {
Deno.removeSync(dst);
}
Deno.symlinkSync(src, dst);
}

function isSymlink(path: string): boolean {
try {
return Deno.lstatSync(path).isSymlink;
} catch (err) {
if (err instanceof Deno.errors.NotFound) {
return false;
}
throw err;
}
}

function get_pkgx() {
for (const path of Deno.env.get("PATH")!.split(":")) {
const pkgx = join(path, "pkgx");
Expand Down
Loading