Skip to content
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

Support receiving current exe path as argument #22

Merged
merged 1 commit into from
Jul 21, 2024

Conversation

davidkna
Copy link
Contributor

If an executable was renamed prior to calling self_delete (e.g. to allow external package managers to update it),
std::env::current_exe may return the pre-renamed path location, notably on Windows.

This PR adds a self_delete_at function that receives the expected exe location as an argument instead of attempting to infer it.
I only added a variant of self_delete, but if necessary I can also add _at variants for other functions.

@mitsuhiko
Copy link
Owner

Can you clarify why this is needed? In which situation does an external system rename the exe and how does one use this?

@davidkna
Copy link
Contributor Author

I wanted to use this feature for topgrade-rs/topgrade#797. The topgrade executable has a feature to rename itself to allow package managers that it runs to update its main executable, and I wanted to use this function for cleanup in that case.

@mitsuhiko mitsuhiko merged commit e397c01 into mitsuhiko:main Jul 21, 2024
7 checks passed
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