Skip to content

Commit e6587e6

Browse files
author
mikachu2333
committed
fix some
1 parent ba01978 commit e6587e6

6 files changed

Lines changed: 224 additions & 25 deletions

File tree

Cargo.lock

Lines changed: 185 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
[package]
22
name = "SC_Starter"
3-
version = "2.8.1"
3+
version = "2.8.2"
44
# 记得更新 types.rs 中 res的版本
55
edition = "2021"
6+
build = "build.rs"
67

78
[profile.release]
89
strip = true
910
lto = true
1011
panic = "abort"
1112

13+
[build-dependencies]
14+
vergen = { version = "9.0.6", features = ["build"] }
15+
1216
[dependencies]
1317
directories = "6.0.0"
1418
single-instance = "0.3.3"

build.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
fn main() {
2+
let time = vergen::BuildBuilder::default()
3+
.build_timestamp(true)
4+
.use_local(true)
5+
.build()
6+
.unwrap();
7+
8+
vergen::Emitter::default()
9+
.add_instructions(&time)
10+
.unwrap()
11+
.emit()
12+
.unwrap();
13+
}

src/file_ops.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
use crate::{
1010
msgbox,
11-
types::{FileExist, PathInfos, RES_HASH},
11+
types::{FileExist, PathInfos, RES_HASH_SHA1},
1212
};
1313
use std::{
1414
collections::HashMap,
@@ -87,13 +87,13 @@ fn check_exe_latest(file_path: &Path) -> bool {
8787
let line = original.lines().nth(1).unwrap();
8888
line.trim().to_ascii_uppercase()
8989
};
90-
RES_HASH.to_ascii_uppercase() == hash_value
90+
RES_HASH_SHA1.to_ascii_uppercase() == hash_value
9191
}
9292

9393
/// 嵌入资源文件的结构体
94-
///
95-
static RES_EXE: &'static [u8] = include_bytes!("../res/ScreenCapture.exe");
96-
static RES_CONF: &'static [u8] = include_bytes!("../res/config.toml");
94+
static RES_EXE: &[u8] = include_bytes!("../res/ScreenCapture.exe");
95+
static RES_CONF: &[u8] = include_bytes!("../res/config.toml");
96+
9797
/// 解压并释放资源文件
9898
///
9999
/// ### 参数
@@ -109,8 +109,7 @@ pub fn unzip_res(paths: &PathInfos, exists: &FileExist) {
109109
let config_res = RES_CONF;
110110

111111
if (!exists.exe_exist) || (!exists.exe_latest) {
112-
fs::write(&paths.exe_path, screen_capture_res)
113-
.expect("Error write EXE file.");
112+
fs::write(&paths.exe_path, screen_capture_res).expect("Error write EXE file.");
114113
println!("EXE: Release exe file.");
115114
} else {
116115
println!("EXE: No need to release.");

0 commit comments

Comments
 (0)