Skip to content

Commit 6813b7d

Browse files
committed
fix: do not instantiate multiple apps to fix tauri-apps/tauri#12934
1 parent b240446 commit 6813b7d

File tree

1 file changed

+3
-9
lines changed
  • templates/{{ '.' }}/{{ project_name }}/src-tauri/src

1 file changed

+3
-9
lines changed

templates/{{ '.' }}/{{ project_name }}/src-tauri/src/main.rs.jinja

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use pyo3::wrap_pymodule;
77
use pytauri::standalone::{
88
dunce::simplified, PythonInterpreterBuilder, PythonInterpreterEnv, PythonScript,
99
};
10-
use tauri::{Builder, Manager as _};
10+
use tauri::utils::platform::resource_dir;
1111

1212
use {{ package_name }}_lib::{ext_mod, tauri_generate_context};
1313

@@ -27,15 +27,9 @@ fn main() -> Result<Infallible, Box<dyn Error>> {
2727
} else {
2828
// embedded Python, i.e., bundle mode with `tauri build`.
2929

30-
// Actually, we don't use this app, we just use it to get the resource directory
31-
let sample_app = Builder::default()
32-
.build(tauri_generate_context())
33-
.map_err(|err| format!("failed to build sample app: {err}"))?;
34-
let resource_dir = sample_app
35-
.path()
36-
.resource_dir()
30+
let context = tauri_generate_context();
31+
let resource_dir = resource_dir(context.package_info(), &tauri::Env::default())
3732
.map_err(|err| format!("failed to get resource dir: {err}"))?;
38-
3933
// 👉 Remove the UNC prefix `\\?\`, Python ecosystems don't like it.
4034
let resource_dir = simplified(&resource_dir).to_owned();
4135

0 commit comments

Comments
 (0)