Skip to content

fix: support windows format path (#2262) #2279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2022

Conversation

HerrCai0907
Copy link
Member

@HerrCai0907 HerrCai0907 commented May 1, 2022

⯈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

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

@dcodeIO
Copy link
Member

dcodeIO commented May 1, 2022

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

@HerrCai0907
Copy link
Member Author

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 HerrCai0907 force-pushed the issue-2262 branch 2 times, most recently from 40ab4c0 to 15e14cb Compare May 2, 2022 01:31
@HerrCai0907
Copy link
Member Author

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

@dcodeIO dcodeIO merged commit 098d8b4 into AssemblyScript:main Sep 25, 2022
@HerrCai0907 HerrCai0907 deleted the issue-2262 branch September 26, 2022 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants