assemblyscript icon indicating copy to clipboard operation
assemblyscript copied to clipboard

fix: support windows format path (#2262)

Open HerrCai0907 opened this issue 3 years ago • 3 comments

⯈using npx asc will transform the path from a\b to a\\b, so the entry path replace reg should be changed from /\\/g to /\\+/g

  • [x] I've read the contributing guidelines
  • [x] I've added my name and email to the NOTICE file

HerrCai0907 avatar May 01 '22 15:05 HerrCai0907

Wouldn't it be more correct to specify a\b on Windows, so in process.argv one gets a singly-escaped "a\\b"?

dcodeIO avatar May 01 '22 16:05 dcodeIO

Wouldn't it be more correct to specify a\b on Windows, so in process.argv one gets a singly-escaped "a\\b"?

It seems that npm do something in windows. In windows when I use node .\node_modules\assemblyscript\bin\asc.js .\assembly\index.ts, I will got argv like ["C:\\Program Files\\nodejs\\node.exe","D:\\as\\node_modules\\assemblyscript\\bin\\asc.js",".\\assembly\\index.ts"] but when I use npx asc .\assembly\index.ts, I will got argv like ["C:\\Program Files\\nodejs\\node.exe","D:\\as\\node_modules\\assemblyscript\\bin\\asc.js",".\\\\assembly\\\\index.ts"]

HerrCai0907 avatar May 02 '22 00:05 HerrCai0907

I find path.normalize can solve this issue and better readability than RegExp

HerrCai0907 avatar May 02 '22 01:05 HerrCai0907