mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-01 10:01:07 +02:00
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>
This commit is contained in:
5
.changes/cli-include-dir-cargo-manifest-dir.md
Normal file
5
.changes/cli-include-dir-cargo-manifest-dir.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri-cli": patch:enhance
|
||||
---
|
||||
|
||||
Use `$CARGO_MANIFEST_DIR` when including templates at build-time.
|
||||
@@ -22,7 +22,7 @@ use clap::Parser;
|
||||
use handlebars::{to_json, Handlebars};
|
||||
use include_dir::{include_dir, Dir};
|
||||
|
||||
const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/app");
|
||||
const TEMPLATE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/templates/app");
|
||||
const TAURI_CONF_TEMPLATE: &str = include_str!("../templates/tauri.conf.json");
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
|
||||
@@ -27,7 +27,7 @@ use std::{
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/mobile/android");
|
||||
const TEMPLATE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/templates/mobile/android");
|
||||
|
||||
pub fn gen(
|
||||
config: &Config,
|
||||
|
||||
@@ -22,7 +22,7 @@ use std::{
|
||||
path::{Component, PathBuf},
|
||||
};
|
||||
|
||||
const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/mobile/ios");
|
||||
const TEMPLATE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/templates/mobile/ios");
|
||||
|
||||
// unprefixed app_root seems pretty dangerous!!
|
||||
// TODO: figure out what cargo-mobile meant by that
|
||||
|
||||
@@ -20,7 +20,7 @@ use std::{
|
||||
path::{Component, Path, PathBuf},
|
||||
};
|
||||
|
||||
pub const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/plugin");
|
||||
pub const TEMPLATE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/templates/plugin");
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[clap(about = "Initialize a Tauri plugin project on an existing directory")]
|
||||
|
||||
Reference in New Issue
Block a user