Self-Replace: A Utility For Self Replacing Executables

Crates.io License rustc 1.61.0 Documentation

self-replace is a crate that allows binaries to replace themselves with newer versions or to uninstall themselves. On Unix systems this is a simple feat, but on Windows a few hacks are needed which is why this crate exists.

This is a useful operation when working with single-executable utilties that want to implement a form of self updating or self uninstallation.

Uninstallation

rust // uninstall self_replace::self_delete()?;

Updates

```rust use std::fs;

let newbinary = "/path/to/new/binary"; selfreplace::selfdelete(&newbinary)?; fs::removefile(&newbinary)?; ```

License and Links