CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/project/servers/browser/root-symlink.ts
Views: 687
1
/*
2
Create the root symbolic link, so that it is possible to
3
browse the entire filesystem, including tmp.
4
*/
5
6
import { access, constants, symlink } from "fs";
7
import { callback } from "awaiting";
8
import { rootSymlink } from "@cocalc/project/data";
9
10
export default async function init(): Promise<void> {
11
try {
12
// not using fs.exists, since it is DEPRECATED.
13
await callback(access, rootSymlink, constants.F_OK);
14
// exists so nothing to do.
15
} catch (_err) {
16
// doesn't exist, so create it
17
await callback(symlink, "/", rootSymlink);
18
}
19
}
20
21