-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
35 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,41 @@ | ||
extern crate embed_resource; | ||
use std::env; | ||
use std::fs; | ||
use std::path::Path; | ||
use std::process::Command; | ||
|
||
fn main() { | ||
let target = std::env::var("TARGET").unwrap(); | ||
// Get the crate version | ||
let version = env::var("CARGO_PKG_VERSION").unwrap(); | ||
// set the CURSOR_HERO_VERSION environment variable | ||
println!("cargo:rustc-env=CURSOR_HERO_VERSION={}", version); | ||
|
||
let target = env::var("TARGET").unwrap(); | ||
if target.contains("windows") { | ||
embed_resource::compile("icon.rc"); | ||
} | ||
|
||
// // Get the crate version | ||
// let version = env::var("CARGO_PKG_VERSION").unwrap(); | ||
|
||
// // Define the original and new binary names | ||
// let original_binary_name = "cursor_hero"; // Replace with your binary name | ||
// let new_binary_name = format!("{}-{}", original_binary_name, version); | ||
// Check if it is a release build | ||
// let profile = env::var("PROFILE").unwrap(); | ||
// if profile == "release" { | ||
// // Define the original and new binary names | ||
// let original_binary_name = "cursor_hero"; // Replace with your binary name | ||
// let new_binary_name = format!("{}_v{}.exe", original_binary_name, version); | ||
|
||
// // Set the output directory (where Cargo puts the compiled binaries) | ||
// let out_dir = env::var("OUT_DIR").unwrap(); | ||
// let target_dir = Path::new(&out_dir).parent().unwrap().parent().unwrap().parent().unwrap(); | ||
// // Set the output directory (where Cargo puts the compiled binaries) | ||
// let out_dir = env::var("OUT_DIR").unwrap(); | ||
// let target_dir = Path::new(&out_dir) | ||
// .parent() | ||
// .unwrap() | ||
// .parent() | ||
// .unwrap() | ||
// .parent() | ||
// .unwrap(); | ||
|
||
// // Construct the paths to the original and new binaries | ||
// let original_binary_path = target_dir.join(original_binary_name); | ||
// let new_binary_path = target_dir.join(new_binary_name); | ||
// // Construct the paths to the original and new binaries | ||
// let original_binary_path = target_dir.join(original_binary_name).with_extension("exe"); | ||
// let new_binary_path = target_dir.join(new_binary_name).with_extension("exe"); | ||
|
||
// // Rename the binary | ||
// Command::new("mv") | ||
// .arg(original_binary_path) | ||
// .arg(new_binary_path) | ||
// .status() | ||
// .unwrap(); | ||
// // Copy the binary | ||
// fs::copy(&original_binary_path, &new_binary_path).expect("Failed to copy the file"); | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters