deno_template_dir
Returns the path to the user's template directory.
The returned value depends on the operating system and is either a string,
containing a value from the following table, or null
.
Platform | Value | Example |
---|---|---|
Linux | XDG_TEMPLATES_DIR |
/home/justjavac/Templates |
macOS | – | – |
Windows | {FOLDERID_Templates} |
C:\Users\justjavac\AppData\Roaming\Microsoft\Windows\Templates |
Usage
Requires allow-env
permission.
Returns null
if there is no applicable directory or if any other error occurs.
import templateDir from "https://deno.land/x/template_dir/mod.ts";
templateDir();
// Lin: "/home/justjavac/Templates"
// Mac: null
// Win: "C:\Users\justjavac\AppData\Roaming\Microsoft\Windows\Templates"
License
deno_template_dir is released under the MIT License. See the bundled LICENSE file for details.