summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorKevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com>2019-08-06 17:32:25 -0700
committerRyan Dahl <ry@tinyclouds.org>2019-08-06 20:32:25 -0400
commit77d0d1e45ccfd33a8a98e2f5fa4ba618759b5dd3 (patch)
tree740e51db9ab98f45c867665583a325555a6dbcdc /js
parent4519f9a50db8852c5b70ff47481f0fc9d0fbe2f2 (diff)
Fix small execPath issues (#2744)
Diffstat (limited to 'js')
-rw-r--r--js/os.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/js/os.ts b/js/os.ts
index 11407cfb0..ff3cd2c2a 100644
--- a/js/os.ts
+++ b/js/os.ts
@@ -159,6 +159,10 @@ export function homeDir(): string {
return path;
}
+/**
+ * Returns the path to the current deno executable.
+ * Requires the `--allow-env` flag.
+ */
export function execPath(): string {
const builder = flatbuffers.createBuilder();
const inner = msg.ExecPath.createExecPath(builder);
@@ -166,11 +170,6 @@ export function execPath(): string {
assert(msg.Any.ExecPathRes === baseRes.innerType());
const res = new msg.ExecPathRes();
assert(baseRes.inner(res) != null);
- const path = res.path();
-
- if (!path) {
- throw new Error("Could not get home directory.");
- }
-
+ const path = res.path()!;
return path;
}