-
Notifications
You must be signed in to change notification settings - Fork 0
Add package installer generics, BepInEx implementation #25
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
base: develop
Are you sure you want to change the base?
Conversation
This is done so to better handle the mapping of modloader variants to specific package installers. We do so via enum as any modification of these variants will incur a compilation error that must be handled.
This commit contains two major features: Traits that define the behavior of filesystem operations and installer functionality, and an early implementation of the bepinex package installer which uses this functionality. New traits: - TrackedFs, which defines the API by which the installer will interact with the filesystem. - PackageInstaller, which defines the functionality and types that an installer implementee must define / consume to function.
BpxInstaller::new(ConcreteFs::new(StateEntry::default())); | ||
|
||
let fs = ConcreteFs::new(StateEntry::default()); | ||
let test = get_installer(&R2MLLoader::BepInEx, fs); |
Check warning
Code scanning / clippy
unused variable: test Warning
Ok(()) | ||
} | ||
|
||
async fn file_delete(&mut self, target: &Path, tracked: bool) { |
Check warning
Code scanning / clippy
unused variable: target Warning
Ok(()) | ||
} | ||
|
||
async fn dir_delete(&mut self, target: &Path, tracked: bool) { |
Check warning
Code scanning / clippy
unused variable: tracked Warning
impl StateEntry { | ||
/// Add a new staged file. If overwrite is set then already existing | ||
/// entries with the same path will be replaced. | ||
pub fn add_staged(&mut self, file: StagedFile, overwrite: bool) { |
Check warning
Code scanning / clippy
unused variable: file Warning
impl StateEntry { | ||
/// Add a new staged file. If overwrite is set then already existing | ||
/// entries with the same path will be replaced. | ||
pub fn add_staged(&mut self, file: StagedFile, overwrite: bool) { |
Check warning
Code scanning / clippy
unused variable: overwrite Warning
|
||
/// Add a new linked file. If overwrite is set then already existing | ||
/// entries with the same path will be replaced. | ||
pub fn add_linked(&mut self, file: TrackedFile, overwrite: bool) { |
Check warning
Code scanning / clippy
unused variable: file Warning
|
||
/// Add a new linked file. If overwrite is set then already existing | ||
/// entries with the same path will be replaced. | ||
pub fn add_linked(&mut self, file: TrackedFile, overwrite: bool) { |
Check warning
Code scanning / clippy
unused variable: overwrite Warning
... And a small edit to the PackageInstaller trait install_package and uninstall_package functions to accept mutable self references, not immutable. In theory this is fine but it opens up problems if we plan on multithreading file ops due to rust's mutable borrow rules. If this becomes a problem (and we NEED mutability) we can rely on something like a RefCell<T: TrackedFile> at the cost of some runtime peformance.
No description provided.