-
Notifications
You must be signed in to change notification settings - Fork 15
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
Allow shim's dirname in path and args #1
Conversation
I'm trying to fix 71#10, but I have no clue on what I'm doing, I'd really appreciate a little help. :( |
The current solution is actually working: ➜ cat C:\Users\felip\AppData\Local\Volta\tools\image\npm\7.9.0\bin\npm.shim
path = C:\Users\felip\AppData\Local\Volta\tools\image\node\14.16.1\node.EXE
args = %~dp0\npm-cli.js
➜ C:\Users\felip\AppData\Local\Volta\tools\image\npm\7.9.0\bin\npm.exe --version
7.9.0 Any tips for improving the performance? |
RegEx isn't really something you use when you're trying to get the fastest performance possible. I don't know anything about C++, but maybe @kiennq could vouch for using a function like this? https://www.cplusplus.com/reference/string/string/replace/ It's just a simple replace operation, no RegEx required. |
Sorry for the late reply, and yes, this feature looks useful. It would be great if you can make it ready for merge :) |
@@ -105,7 +114,9 @@ std::tuple<std::wstring_p, std::wstring_p> GetShimInfo() | |||
continue; | |||
} | |||
} | |||
|
|||
std::wstring key = std::wstring(L"%~dp0"); | |||
path.emplace(std::regex_replace(path.value(), std::wregex(key), dirname)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use replace
instead of regex
version, which seems to be overkilled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felipecrs I was going to compile and test out the PR on your behalf, but I noticed you didn't implement this suggestion. Please do, and remember to remove import <regex>
from the top as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ImportTaste I tried, but I could not think of way to do. If you know how to do it, I would appreciate if you could do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I invited you to my fork, so that you can change push to the PR if you need.
Co-authored-by: kiennq <kien.n.quang@gmail.com>
Co-authored-by: kiennq <kien.n.quang@gmail.com>
Co-authored-by: kiennq <kien.n.quang@gmail.com>
@kiennq, first, thanks for the review. You did everything! Being completely honest with you, I blindly applied all your suggestions, but I have no clue whether they work or not. I have almost zero knowledge about C/C++, and I'm struggling a lot to even being able to build it. Would you mind taking the PR by yourself? I have given permission to you to edit it. I would be so grateful. My goal with the PR was to just highlight the use-case as a PoC, and I'm happy it served that purpose. |
@kiennq I would also like to voice support for integrating the code, I hit a situation today where relative pathing would really be useful. |
Is this still being worked on? |
Not from my side. :) |
de2c0ec
to
e0fb559
Compare
Co-Authored-By: felipecrs <felipecassiors@gmail.com>
Thanks a ton, @kiennq! |
@kiennq This does not appear to be working for me. I've tried:
and
In the case of the former, Sublime Text opens the path as if it's a new unsaved file: In the case of the latter, it just echoes I thought maybe that perhaps it might only work if the args started with it, but that didn't work either:
|
No description provided.