Merge pull request #3524 from ethereum/fix_hardhat_call

fix normalizePath
pull/3508/head
yann300 2 years ago committed by GitHub
commit 6e164d39d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      libs/remixd/src/services/hardhatClient.ts
  2. 6
      libs/remixd/src/utils.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 = ''

@ -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 }

Loading…
Cancel
Save