Skip to content

Commit 325eda4

Browse files
authored
Merge pull request #22 from googleanalytics/fix-dirname
fixed __dirname to work on windows
2 parents 9f485ea + d23c265 commit 325eda4

3 files changed

Lines changed: 116 additions & 2 deletions

File tree

deno.lock

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/deno.lock

Lines changed: 82 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import * as path from "https://deno.land/std@0.224.0/path/mod.ts";
12
import { Eta } from "https://deno.land/x/eta@v3.0.3/src/index.ts";
23
import { parseArgs } from "jsr:@std/cli/parse-args";
34

4-
const __dirname = new URL(".", import.meta.url).pathname;
5+
const __dirname = path.dirname(path.fromFileUrl(import.meta.url));
56

67
const viewpath = Deno.cwd() + "/src/public/";
78
const eta = new Eta({ views: viewpath, cache: true });
@@ -29,7 +30,7 @@ async function handler(request: Request) {
2930
headers: { "content-type": "text/html" },
3031
});
3132
} else {
32-
file = await Deno.open(__dirname + "public" + filepath, {
33+
file = await Deno.open(__dirname + "/public" + filepath, {
3334
read: true,
3435
});
3536
const readableStream = file.readable;

0 commit comments

Comments
 (0)