Skip to content

Commit

Permalink
Merge pull request #2 from rageagainsthepc/shortcut-hidden-window-set…
Browse files Browse the repository at this point in the history
…ting

Set shortcut run property to minimized
  • Loading branch information
rageagainsthepc authored Dec 30, 2021
2 parents 46f6831 + 0dd056f commit d631356
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ampsim-launcher"
version = "0.1.1"
version = "0.1.2"
edition = "2021"

[dependencies]
Expand Down
10 changes: 8 additions & 2 deletions src/link.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
use std::path::Path;

use mslnk::ShellLink;
use stable_eyre::Result;
use mslnk::{ShellLink, ShowCommand};
use stable_eyre::{eyre::bail, Result};

pub(crate) fn make_link(target: &Path, location: &Path) -> Result<()> {
let mut link = ShellLink::new(std::env::current_exe()?)?;
link.set_arguments(Some(format!("-e launch \"{}\"", target.to_string_lossy())));
match target.parent() {
Some(parent) => link.set_working_dir(Some(parent.to_str().unwrap().to_string())),
None => bail!("Unable to determine parent directory of shortcut target"),
}
link.set_icon_location(Some(target.to_str().unwrap().to_string()));
link.header_mut()
.set_show_command(ShowCommand::ShowMinNoActive);

link.create_lnk(location.with_extension("lnk"))?;
Ok(())
Expand Down

0 comments on commit d631356

Please sign in to comment.