ethereumjs/keythereum

Fail in exportToFile under windows

Closed this issue · 2 comments

The source is very simple

keythereum.exportToFile(keyObject, './blockchain/keystore');

The cause is the use of the character ':' in the filename. There is a list of invalid characters in filenames under Windows Naming conventions.

The workaround used by geth is to replace ':' with '-'.

Otherwise the code works without problems under linux.

fs.js:640
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open 'D:\demo\blockchain\keystore\UTC--2017-02-24T20:32:07.469Z--acafe503ff60fd6b7ae0a48ca7c6f70a8f88dada'
    at Error (native)
    at Object.fs.openSync (fs.js:640:18)
    at Object.fs.writeFileSync (fs.js:1333:33)
    at Object.exportToFile (D:\demo\node_modules\keythereum\index.js:566:16)
    at async.eachOfLimit.accounts.admin (D:\demo\blockchain.js:126:22)
    at replenish (D:\demo\node_modules\async\dist\async.js:881:17)
    at D:\demo\node_modules\async\dist\async.js:885:9
    at Object.eachOfLimit (D:\demo\node_modules\async\dist\async.js:912:22)
    at D:\demo\blockchain.js:118:15
    at nextTask (D:\demo\node_modules\async\dist\async.js:5070:14)

Thanks for the heads-up. Should be fixed in 938514e -- I don't have a Windows machine handy to test this, so just re-open this issue if it happens again.

I've tried with the new version and the issue was fixed, now export works correctly under Windows.