fix: use /Users/ instead of /home/ on MacOS

This commit is contained in:
Amin Yahyaabadi 2022-04-24 16:24:58 -07:00
parent fcfb09bb91
commit 861fbd37a1
3 changed files with 7 additions and 3 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,11 @@ import { isRoot } from "../env/sudo"
export function untildify_user(path: string) { export function untildify_user(path: string) {
if (isRoot() && typeof process.env.SUDO_USER === "string") { if (isRoot() && typeof process.env.SUDO_USER === "string") {
// use the user profile even if root // use the user profile even if root
if (process.platform === "darwin") {
return join("/Users/", process.env.SUDO_USER, path)
} else {
return join("/home/", process.env.SUDO_USER, path) return join("/home/", process.env.SUDO_USER, path)
}
} else { } else {
return untildify(`~/${path}`) return untildify(`~/${path}`)
} }