diff --git a/libs/remixd/src/services/hardhatClient.ts b/libs/remixd/src/services/hardhatClient.ts index bf7ca0cc9d..3928e9af64 100644 --- a/libs/remixd/src/services/hardhatClient.ts +++ b/libs/remixd/src/services/hardhatClient.ts @@ -54,7 +54,7 @@ export class HardhatClient extends PluginClient { const errMsg = '[Hardhat Compilation]: Cannot compile in read-only mode' return reject(new Error(errMsg)) } - const cmd = `npx hardhat compile --config ${configPath}` + const cmd = `npx hardhat compile --config ${utils.normalizePath(configPath)}` const options = { cwd: this.currentSharedFolder, shell: true } const child = spawn(cmd, options) let result = '' diff --git a/libs/remixd/src/utils.ts b/libs/remixd/src/utils.ts index 067e5f4113..9c0963e296 100644 --- a/libs/remixd/src/utils.ts +++ b/libs/remixd/src/utils.ts @@ -44,10 +44,10 @@ function relativePath (path: string, sharedFolder: string): string { return normalizePath(relative) } -function normalizePath (path: string): string { +function normalizePath (path) { if (path === '/') path = './' if (process.platform === 'win32') { - return path.replace(/\\/g, '/') + return path.replace(/\//g, '\\') } return path } @@ -114,4 +114,4 @@ function getDomain (url: string) { return domainMatch ? domainMatch[0] : null } -export { absolutePath, relativePath, walkSync, resolveDirectory, getDomain } +export { absolutePath, relativePath, walkSync, resolveDirectory, getDomain, normalizePath }