Skip to content

Commit

Permalink
fix __dirname bug in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
dmca-glasgow committed Jan 24, 2022
1 parent 18221fb commit 2bc8bef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/src/knitr/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { exec } from 'child_process';
import path from 'path';
import { fileURLToPath } from 'url';

import chalk from 'chalk';
import hashSum from 'hash-sum';
Expand All @@ -9,7 +10,7 @@ import { Context } from '../context';
import { warnMessage } from '../utils/message';
import { mkdir, rmFile, writeFile } from '../utils/utils';

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

export async function knitr(file: VFile, ctx: Context) {
const result = await execKnitr(file, ctx);
Expand Down

0 comments on commit 2bc8bef

Please sign in to comment.