remove simple_rc

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-04-17 14:18:00 +08:00
parent b7af404afa
commit 8f51e021c8
10 changed files with 12 additions and 334 deletions

View File

@@ -145,10 +145,6 @@ pub fn core_main() -> Option<Vec<String>> {
args.len() > 1,
));
return None;
} else if args[0] == "--extract" {
#[cfg(feature = "with_rc")]
hbb_common::allow_err!(crate::rc::extract_resources(&args[1]));
return None;
} else if args[0] == "--install-cert" {
#[cfg(windows)]
hbb_common::allow_err!(crate::platform::windows::install_cert(&args[1]));

View File

@@ -64,9 +64,6 @@ mod hbbs_http;
#[cfg(windows)]
pub mod clipboard_file;
#[cfg(all(windows, feature = "with_rc"))]
pub mod rc;
#[cfg(windows)]
pub mod privacy_win_mag;

View File

@@ -1,38 +0,0 @@
use hbb_common::{bail, ResultType};
use std::{
fs::{self, File},
io::prelude::*,
path::Path,
};
#[allow(dead_code)]
pub fn extract_resources(root_path: &str) -> ResultType<()> {
let mut resources: Vec<(&str, &[u8])> = Vec::new();
resources.push((outfile_4, &outdata_4));
do_extract(root_path, resources)?;
Ok(())
}
#[allow(dead_code)]
fn do_extract(root_path: &str, resources: Vec<(&str, &[u8])>) -> ResultType<()> {
let mut root_path = root_path.replace("\\", "/");
if !root_path.ends_with('/') {
root_path.push('/');
}
let root_path = Path::new(&root_path);
for (outfile, data) in resources {
let outfile_path = root_path.join(outfile);
match outfile_path.parent().and_then(|p| p.to_str()) {
None => {
bail!("Failed to get parent of {}", outfile_path.display());
}
Some(p) => {
fs::create_dir_all(p)?;
let mut of = File::create(outfile_path)?;
of.write_all(data)?;
of.flush()?;
}
}
}
Ok(())
}