Browse Source

Fix aliases (#103)

remotes/origin/add-simple-redirecting-site
Gal Schlezinger 6 years ago committed by GitHub
parent
commit
ae336a7a3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      executable/Use.re
  2. 12
      library/Versions.re

7
executable/Use.re

@ -29,7 +29,6 @@ let switchVersion = (~version, ~quiet) => { @@ -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) => { @@ -37,17 +36,17 @@ let switchVersion = (~version, ~quiet) => {
"Linking "
<Pastel color=Pastel.Cyan> source </Pastel>
" to "
<Pastel color=Pastel.Cyan> destination </Pastel>
<Pastel color=Pastel.Cyan> versionPath </Pastel>
</Pastel>,
);
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();
};

12
library/Versions.re

@ -31,9 +31,17 @@ module Local = { @@ -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);

Loading…
Cancel
Save