Skip to content

Commit 1f4ca15

Browse files
authored
Merge pull request #18 from CeerDecy/fix/windows-build
fix: windows build bugs
2 parents 4ac4697 + 578cf0a commit 1f4ca15

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

auto-engine-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ serde_json = "1.0"
99
serde_yaml = "0.9.34"
1010
serde = { version = "1.0", features = ["derive"] }
1111
log = "0.4"
12-
opencv = { version = "0", features = ["clang-runtime"] }
12+
opencv = { version = "0", default-features = false, features = ["clang-runtime", "imgproc", "imgcodecs"] }
1313
tauri = { version = "2.9.4", features = [] }
1414
regex = "1.11.2"
1515
futures = "0.3"

auto-engine-core/src/node/ocr/runner.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,16 @@ impl NodeRunner for OcrRunner {
4444
ctx: &Context,
4545
param: Self::ParamType,
4646
) -> Result<Option<HashMap<String, serde_json::Value>>, String> {
47-
let handle = ctx.app_handle.clone().unwrap();
47+
let mut resource_path_prefix = ctx.resource_path().to_string_lossy().replace(r"\\?\", "").to_string();
4848

49-
let resource_path = if ctx.resource_path().to_string_lossy().to_string() != "" {
50-
format!("{}/",ctx.resource_path().to_string_lossy().to_string())
51-
} else {
52-
String::new()
53-
};
49+
if resource_path_prefix != "" {
50+
resource_path_prefix = format!("{}/", resource_path_prefix);
51+
}
5452

5553
let ocr = OAROCRBuilder::new(
56-
format!("{}{}",resource_path,"ocr/pp-ocrv5_mobile_det.onnx").as_str(),
57-
format!("{}{}",resource_path,"ocr/pp-ocrv5_mobile_rec.onnx").as_str(),
58-
format!("{}{}",resource_path,"ocr/ppocrv5_dict.txt").as_str(),
54+
format!("{}{}", resource_path_prefix, "ocr/pp-ocrv5_mobile_det.onnx").as_str(),
55+
format!("{}{}", resource_path_prefix, "ocr/pp-ocrv5_mobile_rec.onnx").as_str(),
56+
format!("{}{}", resource_path_prefix, "ocr/ppocrv5_dict.txt").as_str(),
5957
)
6058
.build()
6159
.map_err(|e| {

0 commit comments

Comments
 (0)