Skip to content
This repository was archived by the owner on Sep 28, 2024. It is now read-only.

Support on Windows #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export async function getDenoDir() {
Deno.env.get("HOME") + "/.cache") + "/deno";
case "darwin":
return Deno.env.get("HOME") + "/Library/Caches/deno";
case "windows":
return Deno.env.get("LOCALAPPDATA") + "/deno";
}
}

Expand Down
5 changes: 4 additions & 1 deletion injector_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ const os = Deno.build.os;

Deno.env.delete("DENO_DIR");
Deno.env.set("HOME", "testhome");
Deno.env.set("LOCALAPPDATA", "testhome");
Deno.env.delete("XDG_CACHE_HOME");

Deno.test({
name: "hoge",
ignore: os !== "linux" && os !== "darwin",
ignore: os !== "linux" && os !== "darwin" && os !== "windows",
async fn() {
if (os === "linux") {
assertEquals(await getDenoDir(), "testhome/.cache/deno");
Deno.env.set("XDG_CACHE_HOME", "testcachehome");
assertEquals(await getDenoDir(), "testcachehome/deno");
} else if (os === "darwin") {
assertEquals(await getDenoDir(), "testhome/Library/Caches/deno");
} else if (os === "windows") {
assertEquals(await getDenoDir(), "testhome/deno");
}
Deno.env.set("DENO_DIR", "testdenodir");
assertEquals(await getDenoDir(), "testdenodir");
Expand Down