Skip to content

Commit

Permalink
Merge pull request #22 from googleanalytics/fix-dirname
Browse files Browse the repository at this point in the history
fixed __dirname to work on windows
  • Loading branch information
matt-landers authored May 13, 2024
2 parents 9f485ea + d23c265 commit 325eda4
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 2 deletions.
31 changes: 31 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 82 additions & 0 deletions src/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as path from "https://deno.land/[email protected]/path/mod.ts";
import { Eta } from "https://deno.land/x/[email protected]/src/index.ts";
import { parseArgs } from "jsr:@std/cli/parse-args";

const __dirname = new URL(".", import.meta.url).pathname;
const __dirname = path.dirname(path.fromFileUrl(import.meta.url));

const viewpath = Deno.cwd() + "/src/public/";
const eta = new Eta({ views: viewpath, cache: true });
Expand Down Expand Up @@ -29,7 +30,7 @@ async function handler(request: Request) {
headers: { "content-type": "text/html" },
});
} else {
file = await Deno.open(__dirname + "public" + filepath, {
file = await Deno.open(__dirname + "/public" + filepath, {
read: true,
});
const readableStream = file.readable;
Expand Down

0 comments on commit 325eda4

Please sign in to comment.