Skip to content

Commit 6703b7c

Browse files
authored
fix: use $CARGO_MANIFEST_DIR to fully specify include_dir paths in tauri-cli (#9310)
* Allow tauri-cli to work with Bazel. Signed-off-by: Scott Pledger <scottpledger2005@gmail.com> * change file --------- Signed-off-by: Scott Pledger <scottpledger2005@gmail.com>
1 parent 5bd47b4 commit 6703b7c

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-cli": patch:enhance
3+
---
4+
5+
Use `$CARGO_MANIFEST_DIR` when including templates at build-time.

tooling/cli/src/init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use clap::Parser;
2222
use handlebars::{to_json, Handlebars};
2323
use include_dir::{include_dir, Dir};
2424

25-
const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/app");
25+
const TEMPLATE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/templates/app");
2626
const TAURI_CONF_TEMPLATE: &str = include_str!("../templates/tauri.conf.json");
2727

2828
#[derive(Debug, Parser)]

tooling/cli/src/mobile/android/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use std::{
2727
path::{Path, PathBuf},
2828
};
2929

30-
const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/mobile/android");
30+
const TEMPLATE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/templates/mobile/android");
3131

3232
pub fn gen(
3333
config: &Config,

tooling/cli/src/mobile/ios/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use std::{
2222
path::{Component, PathBuf},
2323
};
2424

25-
const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/mobile/ios");
25+
const TEMPLATE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/templates/mobile/ios");
2626

2727
// unprefixed app_root seems pretty dangerous!!
2828
// TODO: figure out what cargo-mobile meant by that

tooling/cli/src/plugin/init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use std::{
2020
path::{Component, Path, PathBuf},
2121
};
2222

23-
pub const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/plugin");
23+
pub const TEMPLATE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/templates/plugin");
2424

2525
#[derive(Debug, Parser)]
2626
#[clap(about = "Initialize a Tauri plugin project on an existing directory")]

0 commit comments

Comments
 (0)