mirror of
https://github.com/yuzu-emu/liftinstall.git
synced 2025-11-05 07:35:01 +00:00
* platform: fix build on Linux and update web-view * deps: replace xz-decom with xz2 and update deps * platform: fix regression... ... that prevents the build on Windows * linux: implement platform-dependent functions * travis: add macos and windows CI * travis: use official Rust Docker image * Update Cargo.lock for new version * Break apart REST into separate services This cleans up locking, ensures consistent futures for all endpoints and enhances code re-use. * Clean up codebase, fixing minor errors * Update packages, use async client for downloading config While this has a hell of a lot more boilerplate, this is quite a bit cleaner. * Add explicit 'dyn's as per Rust nightly requirements * Migrate self updating functions to own module * Migrate assets to server module * Use patched web-view to fix dialogs, remove nfd * Implement basic dark mode * Revert window.close usage * ui: split files and use Webpack * frontend: ui: include prebuilt assets... ... and update rust side stuff * build: integrate webpack building into build.rs * Polish Vue UI split * Add instructions for node + yarn * native: fix uninstall self-destruction behavior...... by not showing the command prompt window and fork-spawning the cmd * native: deal with Unicode issues in native APIs * native: further improve Unicode support on Windows * travis: add cache and fix issues * ui: use Buefy components to... ... beautify the UI * ui: makes error message selectable * Make launcher mode behaviour more robust * Fix error display on launcher pages * Correctly handle exit on error * Bump installer version
100 lines
2.7 KiB
Rust
100 lines
2.7 KiB
Rust
//! Generates shortcuts for a specified file.
|
|
|
|
use installer::InstallerFramework;
|
|
|
|
use tasks::Task;
|
|
use tasks::TaskDependency;
|
|
use tasks::TaskMessage;
|
|
use tasks::TaskParamType;
|
|
|
|
use config::PackageDescription;
|
|
|
|
use logging::LoggingErrors;
|
|
|
|
use native::create_shortcut;
|
|
|
|
pub struct InstallShortcutsTask {
|
|
pub name: String,
|
|
}
|
|
|
|
impl Task for InstallShortcutsTask {
|
|
fn execute(
|
|
&mut self,
|
|
_: Vec<TaskParamType>,
|
|
context: &mut InstallerFramework,
|
|
messenger: &dyn Fn(&TaskMessage),
|
|
) -> Result<TaskParamType, String> {
|
|
messenger(&TaskMessage::DisplayMessage(
|
|
&format!("Generating shortcuts for package {:?}...", self.name),
|
|
0.0,
|
|
));
|
|
|
|
let path = context
|
|
.install_path
|
|
.as_ref()
|
|
.log_expect("No install path specified");
|
|
|
|
let starting_dir = path
|
|
.to_str()
|
|
.log_expect("Unable to build shortcut metadata (startingdir)");
|
|
|
|
let mut installed_files = Vec::new();
|
|
|
|
let mut metadata: Option<PackageDescription> = None;
|
|
for description in &context
|
|
.config
|
|
.as_ref()
|
|
.log_expect("Should have packages by now")
|
|
.packages
|
|
{
|
|
if self.name == description.name {
|
|
metadata = Some(description.clone());
|
|
break;
|
|
}
|
|
}
|
|
|
|
let package = match metadata {
|
|
Some(v) => v,
|
|
None => return Err(format!("Package {:?} could not be found.", self.name)),
|
|
};
|
|
|
|
// Generate installer path
|
|
let platform_extension = if cfg!(windows) {
|
|
"maintenancetool.exe"
|
|
} else {
|
|
"maintenancetool"
|
|
};
|
|
|
|
for shortcut in package.shortcuts {
|
|
let tool_path = path.join(platform_extension);
|
|
let tool_path = tool_path
|
|
.to_str()
|
|
.log_expect("Unable to build shortcut metadata (tool)");
|
|
|
|
let exe_path = path.join(shortcut.relative_path);
|
|
let exe_path = exe_path
|
|
.to_str()
|
|
.log_expect("Unable to build shortcut metadata (exe)");
|
|
|
|
installed_files.push(create_shortcut(
|
|
&shortcut.name,
|
|
&shortcut.description,
|
|
tool_path,
|
|
// TODO: Send by list
|
|
&format!("--launcher \"{}\"", exe_path),
|
|
&starting_dir,
|
|
)?);
|
|
}
|
|
|
|
Ok(TaskParamType::GeneratedShortcuts(installed_files))
|
|
}
|
|
|
|
fn dependencies(&self) -> Vec<TaskDependency> {
|
|
vec![]
|
|
}
|
|
|
|
fn name(&self) -> String {
|
|
format!("InstallShortcutsTask (for {:?})", self.name)
|
|
}
|
|
}
|