mirror of
https://github.com/tauri-apps/tauri.git
synced 2025-01-05 09:52:50 +03:00
parent
0198c2ba45
commit
f66bc3c2b8
5
.changes/fix-dll-resource.md
Normal file
5
.changes/fix-dll-resource.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"tauri-bundler": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixes DLL resource usage on Windows.
|
@ -796,34 +796,7 @@ fn generate_resource_data(settings: &Settings) -> crate::Result<ResourceMap> {
|
|||||||
let mut resources = ResourceMap::new();
|
let mut resources = ResourceMap::new();
|
||||||
let cwd = std::env::current_dir()?;
|
let cwd = std::env::current_dir()?;
|
||||||
|
|
||||||
let mut dlls = vec![];
|
let mut added_resources = Vec::new();
|
||||||
for dll in glob::glob(
|
|
||||||
settings
|
|
||||||
.project_out_directory()
|
|
||||||
.join("*.dll")
|
|
||||||
.to_string_lossy()
|
|
||||||
.to_string()
|
|
||||||
.as_str(),
|
|
||||||
)? {
|
|
||||||
let path = dll?;
|
|
||||||
let resource_path = path.to_string_lossy().to_string();
|
|
||||||
dlls.push(ResourceFile {
|
|
||||||
id: format!("I{}", Uuid::new_v4().as_simple()),
|
|
||||||
guid: Uuid::new_v4().to_string(),
|
|
||||||
path: resource_path,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if !dlls.is_empty() {
|
|
||||||
resources.insert(
|
|
||||||
"".to_string(),
|
|
||||||
ResourceDirectory {
|
|
||||||
path: "".to_string(),
|
|
||||||
name: "".to_string(),
|
|
||||||
directories: vec![],
|
|
||||||
files: dlls,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
for src in settings.resource_files() {
|
for src in settings.resource_files() {
|
||||||
let src = src?;
|
let src = src?;
|
||||||
@ -834,6 +807,8 @@ fn generate_resource_data(settings: &Settings) -> crate::Result<ResourceMap> {
|
|||||||
.into_string()
|
.into_string()
|
||||||
.expect("failed to read resource path");
|
.expect("failed to read resource path");
|
||||||
|
|
||||||
|
added_resources.push(resource_path.clone());
|
||||||
|
|
||||||
let resource_entry = ResourceFile {
|
let resource_entry = ResourceFile {
|
||||||
id: format!("I{}", Uuid::new_v4().as_simple()),
|
id: format!("I{}", Uuid::new_v4().as_simple()),
|
||||||
guid: Uuid::new_v4().to_string(),
|
guid: Uuid::new_v4().to_string(),
|
||||||
@ -904,5 +879,37 @@ fn generate_resource_data(settings: &Settings) -> crate::Result<ResourceMap> {
|
|||||||
directory_entry.add_file(resource_entry);
|
directory_entry.add_file(resource_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut dlls = Vec::new();
|
||||||
|
|
||||||
|
let out_dir = settings.project_out_directory();
|
||||||
|
for dll in glob::glob(out_dir.join("*.dll").to_string_lossy().to_string().as_str())? {
|
||||||
|
let path = dll?;
|
||||||
|
let resource_path = path.to_string_lossy().into_owned();
|
||||||
|
let relative_path = path
|
||||||
|
.strip_prefix(&out_dir)
|
||||||
|
.unwrap()
|
||||||
|
.to_string_lossy()
|
||||||
|
.into_owned();
|
||||||
|
if !added_resources.iter().any(|r| r.ends_with(&relative_path)) {
|
||||||
|
dlls.push(ResourceFile {
|
||||||
|
id: format!("I{}", Uuid::new_v4().as_simple()),
|
||||||
|
guid: Uuid::new_v4().to_string(),
|
||||||
|
path: resource_path,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !dlls.is_empty() {
|
||||||
|
resources.insert(
|
||||||
|
"".to_string(),
|
||||||
|
ResourceDirectory {
|
||||||
|
path: "".to_string(),
|
||||||
|
name: "".to_string(),
|
||||||
|
directories: vec![],
|
||||||
|
files: dlls,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(resources)
|
Ok(resources)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user