mirror of https://github.com/aminya/setup-cpp
13 lines
357 B
TypeScript
13 lines
357 B
TypeScript
|
import { join } from "path"
|
||
|
import untildify from "untildify"
|
||
|
import { isRoot } from "../env/sudo"
|
||
|
|
||
|
export function untildify_user(path: string) {
|
||
|
if (isRoot() && typeof process.env.SUDO_USER === "string") {
|
||
|
// use the user profile even if root
|
||
|
return join("/home/", process.env.SUDO_USER, path)
|
||
|
} else {
|
||
|
return untildify(`~/${path}`)
|
||
|
}
|
||
|
}
|