diff --git a/injector.ts b/injector.ts index cbc83a9..45b832a 100644 --- a/injector.ts +++ b/injector.ts @@ -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"; } } diff --git a/injector_test.ts b/injector_test.ts index f15a30a..cde5c9e 100644 --- a/injector_test.ts +++ b/injector_test.ts @@ -5,11 +5,12 @@ 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"); @@ -17,6 +18,8 @@ Deno.test({ 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");