Skip to content

Commit

Permalink
fix launcher icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr1Furious committed Dec 28, 2024
1 parent fe8689a commit 8af28e7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
22 changes: 17 additions & 5 deletions launcher/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,25 @@ fn main() {
}
fs::write(dest_path, config_content).unwrap();

let data_launcher_name = env::var("LAUNCHER_NAME")
.unwrap()
.to_lowercase()
.replace(" ", "_");
let mut res = winres::WindowsResource::new();

if cfg!(target_os = "windows") {
let data_launcher_name = env::var("LAUNCHER_NAME")
.unwrap()
.to_lowercase()
.replace(" ", "_");
let mut res = winres::WindowsResource::new();
res.set_icon(&format!("assets/{}.ico", data_launcher_name));
res.compile().unwrap();
}

let icon_src = format!(
"{}/assets/{}.png",
env::var("CARGO_MANIFEST_DIR").unwrap(),
data_launcher_name
);
let icon_out = format!("{}/icon_file_bytes.rs", out_dir);
fs::write(
&icon_out,
format!("pub const LAUNCHER_ICON: &[u8] = include_bytes!(\"{}\");", icon_src),
).unwrap();
}
4 changes: 2 additions & 2 deletions launcher/src/config/build_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ pub fn get_version() -> Option<String> {
VERSION.map(|version| version.to_string())
}

pub const LAUNCHER_ICON: &[u8] = include_bytes!("../../assets/potato_launcher.png");

pub const LIBRARY_OVERRIDES: &str = include_str!("../../meta/library-overrides.json");

pub const MOJANG_LIBRARY_PATCHES: &str = include_str!("../../meta/mojang-library-patches.json");

pub const LWJGL_VERSION_MATCHES: &str = include_str!("../../meta/lwjgl-version-matches.json");

include!(concat!(env!("OUT_DIR"), "/icon_file_bytes.rs"));

0 comments on commit 8af28e7

Please sign in to comment.