diff options
author | Evgeniy Karagodin <ekaragodin@gmail.com> | 2019-07-08 02:41:09 +0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-07-07 15:41:09 -0400 |
commit | c08a27de9ac136d212b6510976435e1fc9694dc8 (patch) | |
tree | 58ed448e05847da7aef7e41ec5415fc17d31345e /os/mod.ts | |
parent | 9a01d6455ec3cfa955967102f576cb542999321a (diff) |
Remove os.userHomeDir in favor of Deno.homeDir (denoland/deno_std#523)
Original: https://github.com/denoland/deno_std/commit/88b48945799322c0bc2f34134eed538759de4174
Diffstat (limited to 'os/mod.ts')
-rw-r--r-- | os/mod.ts | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/os/mod.ts b/os/mod.ts deleted file mode 100644 index a2bb0457b..000000000 --- a/os/mod.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. - -/** - * Returns the current user's home directory. - * On Unix, including macOS, it returns the $HOME environment variable. - * On Windows, it returns %USERPROFILE%. - * Needs permissions to access env (--allow-env). - * - * Ported from Go: https://github.com/golang/go/blob/go1.12.5/src/os/file.go#L389 - */ -export function userHomeDir(): string { - let env = "HOME"; - let envErr = "$HOME"; - - if (Deno.platform.os === "win") { - env = "USERPROFILE"; - envErr = "%USERPROFILE%"; - } - - const value = Deno.env()[env]; - if (value !== "") { - return value; - } - - throw new Error(`Environment variable '${envErr}' is not defined.`); -} |