Closed djriffel closed 3 years ago
Thanks for reporting! Should be fixed by https://github.com/frangio/hardhat-exposed/commit/0a7dd07b1444a40607fe59aa1d549f6df4906e83. Please try the latest release and let me know.
Hello, thanks for the super quick response!
It seems some of the operations from the new posix import don't work very well on Windows.
I now get the following error from my compile task:
[Error: ENOENT: no such file or directory, mkdir 'C:\Users\myUser\Projects\dapps\my-dapp\contracts-exposed\..C:\Users\myUser\Projects\dapps\my-dapp\contracts'] {
errno: -4058,
code: 'ENOENT',
syscall: 'mkdir',
path: 'C:\\Users\\myUser\\Projects\\dapps\\my-dapp\\contracts-exposed\\..C:\\Users\\myUser\\Projects\\dapps\\my-dapp\\contracts'
}
If it helps with troubleshooting, I printed some of the variable states from the getExposed() function. These values are from around line 34 in core.ts
:
rootPath
C:\Users\myUser\Projects\dapps\my-dapp
sourcesPath
C:\Users\myUser\Projects\dapps\my-dapp\contracts
rootRelativeSourcesPath
../C:\Users\myUser\Projects\dapps\my-dapp\contracts
ast.absolutePath
contracts/mocks/MockUserMessaging.sol
path_1.posix.relative(rootRelativeSourcesPath, ast.absolutePath)
..C:\Users\myUser\Projects\dapps\my-dapp/contracts/mocks/MockUserMessaging.sol
exports.exposedPath
C:\Users\myUser\Projects\dapps\my-dapp/contracts-exposed
destPath
C:\Users\myUser\Projects\dapps\my-dapp/contracts-exposed/..C:\Users\myUser\Projects\dapps\my-dapp/contracts/mocks/MockUserMessaging.sol
I guess I tried to be too clever. :smile:
I've published the fix you originally suggested now.
Awesome! Looks like it's all good now, working like a charm. Thanks! 😃
Hi, great library! One note: The generated XContract files on windows cause compilation issues because of the backslashes in the path for the Windows environment.
I fixed this within the source of the plugin by just appending a replace() for the backslash character.
(I made these changes in the /dist js files, but I'm illustrating with the /src counterparts here)...
in core.ts, getExposedFile(), line 43:
const inputPath = path.relative(path.dirname(absolutePath), ast.absolutePath);
I just appended the following:
.replace(/\\/g, '/')
This makes the new line:const inputPath = path.relative(path.dirname(absolutePath), ast.absolutePath).replace(/\\/g, '/');
I'm not sure if this would break anything in environments that use backslashes for spaces in their paths or anything like that. But this is what worked for me on my Windows box.