mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 21:50:00 -05:00
Fix small execPath issues (#2744)
This commit is contained in:
parent
4519f9a50d
commit
77d0d1e45c
1 changed files with 5 additions and 6 deletions
11
js/os.ts
11
js/os.ts
|
@ -159,6 +159,10 @@ export function homeDir(): string {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the path to the current deno executable.
|
||||||
|
* Requires the `--allow-env` flag.
|
||||||
|
*/
|
||||||
export function execPath(): string {
|
export function execPath(): string {
|
||||||
const builder = flatbuffers.createBuilder();
|
const builder = flatbuffers.createBuilder();
|
||||||
const inner = msg.ExecPath.createExecPath(builder);
|
const inner = msg.ExecPath.createExecPath(builder);
|
||||||
|
@ -166,11 +170,6 @@ export function execPath(): string {
|
||||||
assert(msg.Any.ExecPathRes === baseRes.innerType());
|
assert(msg.Any.ExecPathRes === baseRes.innerType());
|
||||||
const res = new msg.ExecPathRes();
|
const res = new msg.ExecPathRes();
|
||||||
assert(baseRes.inner(res) != null);
|
assert(baseRes.inner(res) != null);
|
||||||
const path = res.path();
|
const path = res.path()!;
|
||||||
|
|
||||||
if (!path) {
|
|
||||||
throw new Error("Could not get home directory.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue