summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/js/lib.deno_runtime.d.ts14
-rw-r--r--cli/js/os.ts14
-rw-r--r--cli/js/os_test.ts8
-rw-r--r--cli/ops/os.rs1
4 files changed, 31 insertions, 6 deletions
diff --git a/cli/js/lib.deno_runtime.d.ts b/cli/js/lib.deno_runtime.d.ts
index e667d497d..d955c09bf 100644
--- a/cli/js/lib.deno_runtime.d.ts
+++ b/cli/js/lib.deno_runtime.d.ts
@@ -59,6 +59,7 @@ declare namespace Deno {
| "home"
| "cache"
| "config"
+ | "executable"
| "data"
| "data_local"
| "audio"
@@ -77,9 +78,9 @@ declare namespace Deno {
* Returns null if there is no applicable directory or if any other error
* occurs.
*
- * Argument values: "home", "cache", "config", "data", "data_local", "audio",
- * "desktop", "document", "download", "font", "picture", "public", "template",
- * "video"
+ * Argument values: "home", "cache", "config", "executable", "data",
+ * "data_local", "audio", "desktop", "document", "download", "font", "picture",
+ * "public", "template", "video"
*
* "cache"
* |Platform | Value | Example |
@@ -95,6 +96,13 @@ declare namespace Deno {
* | macOS | `$HOME`/Library/Preferences | /Users/Alice/Library/Preferences |
* | Windows | `{FOLDERID_RoamingAppData}` | C:\Users\Alice\AppData\Roaming |
*
+ * "executable"
+ * |Platform | Value | Example |
+ * | ------- | --------------------------------------------------------------- | -----------------------|
+ * | Linux | `XDG_BIN_HOME` or `$XDG_DATA_HOME`/../bin or `$HOME`/.local/bin | /home/alice/.local/bin |
+ * | macOS | - | - |
+ * | Windows | - | - |
+ *
* "data"
* |Platform | Value | Example |
* | ------- | ---------------------------------------- | ---------------------------------------- |
diff --git a/cli/js/os.ts b/cli/js/os.ts
index 8e91be4af..c2d7a8f78 100644
--- a/cli/js/os.ts
+++ b/cli/js/os.ts
@@ -133,6 +133,7 @@ type DirKind =
| "home"
| "cache"
| "config"
+ | "executable"
| "data"
| "data_local"
| "audio"
@@ -151,9 +152,9 @@ type DirKind =
* Returns null if there is no applicable directory or if any other error
* occurs.
*
- * Argument values: "home", "cache", "config", "data", "data_local", "audio",
- * "desktop", "document", "download", "font", "picture", "public", "template",
- * "video"
+ * Argument values: "home", "cache", "config", "executable", "data",
+ * "data_local", "audio", "desktop", "document", "download", "font", "picture",
+ * "public", "template", "video"
*
* "cache"
* |Platform | Value | Example |
@@ -169,6 +170,13 @@ type DirKind =
* | macOS | `$HOME`/Library/Preferences | /Users/Alice/Library/Preferences |
* | Windows | `{FOLDERID_RoamingAppData}` | C:\Users\Alice\AppData\Roaming |
*
+ * "executable"
+ * |Platform | Value | Example |
+ * | ------- | --------------------------------------------------------------- | -----------------------|
+ * | Linux | `XDG_BIN_HOME` or `$XDG_DATA_HOME`/../bin or `$HOME`/.local/bin | /home/alice/.local/bin |
+ * | macOS | - | - |
+ * | Windows | - | - |
+ *
* "data"
* |Platform | Value | Example |
* | ------- | ---------------------------------------- | ---------------------------------------- |
diff --git a/cli/js/os_test.ts b/cli/js/os_test.ts
index 55a62792d..749c25d83 100644
--- a/cli/js/os_test.ts
+++ b/cli/js/os_test.ts
@@ -147,6 +147,14 @@ testPerm({ env: true }, function getDir(): void {
]
},
{
+ kind: "executable",
+ runtime: [
+ { os: "mac", shouldHaveValue: false },
+ { os: "win", shouldHaveValue: false },
+ { os: "linux", shouldHaveValue: true }
+ ]
+ },
+ {
kind: "data",
runtime: [
{ os: "mac", shouldHaveValue: true },
diff --git a/cli/ops/os.rs b/cli/ops/os.rs
index 03f81838c..c42827b3f 100644
--- a/cli/ops/os.rs
+++ b/cli/ops/os.rs
@@ -75,6 +75,7 @@ fn op_get_dir(
"home" => dirs::home_dir(),
"config" => dirs::config_dir(),
"cache" => dirs::cache_dir(),
+ "executable" => dirs::executable_dir(),
"data" => dirs::data_dir(),
"data_local" => dirs::data_local_dir(),
"audio" => dirs::audio_dir(),