Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/jupyter/util/fs.ts
1447 views
1
import { homedir } from "os";
2
import { resolve } from "path";
3
4
export function getAbsolutePathFromHome(relativePath: string): string {
5
if (relativePath[0] == "/") {
6
// actually an absolute path.
7
return relativePath;
8
}
9
// NOTE: call homedir each time, since client code (e.g., for compute servers)
10
// may change the HOME env var dynamically at runtime.
11
return resolve(homedir(), relativePath);
12
}
13
14