Skip to content

Commit 4972d61

Browse files
authored
Merge pull request #67 from pkgxdev/fixes/66
Fixes #66
2 parents bf387b6 + 7671c44 commit 4972d61

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pkgm.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,9 @@ async function create_v_symlinks(prefix: string) {
429429
for await (const { name, isDirectory, isSymlink } of Deno.readDir(shelf)) {
430430
if (isSymlink) continue;
431431
if (!isDirectory) continue;
432-
if (!name.startsWith("v")) continue;
433432
if (name == "var") continue;
433+
if (!name.startsWith("v")) continue;
434+
if (/^v\d+$/.test(name)) continue; // pcre.org/v2
434435
const version = semver.parse(name);
435436
if (version) {
436437
versions.push(version);
@@ -494,7 +495,7 @@ function expand_runtime_env(
494495
}
495496

496497
function symlink_with_overwrite(src: string, dst: string) {
497-
if (existsSync(dst)) {
498+
if (existsSync(dst) && Deno.lstatSync(dst).isSymlink) {
498499
Deno.removeSync(dst);
499500
}
500501
Deno.symlinkSync(src, dst);
@@ -505,9 +506,9 @@ function get_pkgx() {
505506
const pkgx = join(path, "pkgx");
506507
if (existsSync(pkgx)) {
507508
const out = new Deno.Command(pkgx, { args: ["--version"] }).outputSync();
508-
const match = new TextDecoder().decode(out.stdout).match(/pkgx 2.(\d+)/);
509-
if (!match || parseInt(match[1]) < 4) {
510-
console.error("pkgm requires pkgx 2.4.0 or later");
509+
const stdout = new TextDecoder().decode(out.stdout);
510+
const match = stdout.match(/^pkgx (\d+.\d+)/);
511+
if (!match || parseFloat(match[1]) < 2.4) {
511512
Deno.exit(1);
512513
}
513514
return pkgx;

0 commit comments

Comments
 (0)