From ae336a7a3d9db98a4040065e6e9e021a3be12764 Mon Sep 17 00:00:00 2001 From: Gal Schlezinger Date: Sun, 26 May 2019 15:37:37 +0300 Subject: [PATCH] Fix aliases (#103) --- executable/Use.re | 7 +++---- library/Versions.re | 12 ++++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/executable/Use.re b/executable/Use.re index c46ded9..34cb7a0 100644 --- a/executable/Use.re +++ b/executable/Use.re @@ -29,7 +29,6 @@ let switchVersion = (~version, ~quiet) => { | System => "system" }; - let destination = Filename.concat(versionPath, "installation"); let source = Directories.currentVersion; log( @@ -37,17 +36,17 @@ let switchVersion = (~version, ~quiet) => { "Linking " source " to " - destination + versionPath , ); let%lwt _ = Lwt_unix.unlink(Directories.currentVersion) |> lwtIgnore; - let%lwt _ = Lwt_unix.symlink(destination, Directories.currentVersion) + let%lwt _ = Lwt_unix.symlink(versionPath, Directories.currentVersion) and defaultAliasExists = Lwt_unix.file_exists(Directories.defaultVersion); let%lwt _ = if (!defaultAliasExists) { - Versions.Aliases.set(~alias="default", ~versionPath=destination); + Versions.Aliases.set(~alias="default", ~versionPath); } else { Lwt.return(); }; diff --git a/library/Versions.re b/library/Versions.re index 0b11ad1..19353d3 100644 --- a/library/Versions.re +++ b/library/Versions.re @@ -31,9 +31,17 @@ module Local = { aliases: list(string), }; - let systemVersion: t = {name: "system", fullPath: "/dev/null", aliases: []}; + let systemVersion: t = { + name: "system", + fullPath: "/dev/null/installation", + aliases: [], + }; - let toDirectory = name => Filename.concat(Directories.nodeVersions, name); + let toDirectory = name => + Filename.concat( + Filename.concat(Directories.nodeVersions, name), + "installation", + ); let remove = version => Fs.rmdir(version.fullPath);