From c6031c7070c6bb7539bbfdfe42cb73012829c910 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Sun, 13 Feb 2022 22:13:13 -0300 Subject: [PATCH] feat(cli): increase lookup depth, add env var option (#3451) --- .changes/increase-tauri-dir-lookup-depth.md | 6 ++++++ tooling/cli/src/helpers/app_paths.rs | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .changes/increase-tauri-dir-lookup-depth.md diff --git a/.changes/increase-tauri-dir-lookup-depth.md b/.changes/increase-tauri-dir-lookup-depth.md new file mode 100644 index 000000000..eb9ac27f3 --- /dev/null +++ b/.changes/increase-tauri-dir-lookup-depth.md @@ -0,0 +1,6 @@ +--- +"cli.rs": patch +"cli.js": patch +--- + +Increase `tauri.conf.json` directory lookup depth to `3` and allow changing it with the `TAURI_PATH_DEPTH` environment variable. diff --git a/tooling/cli/src/helpers/app_paths.rs b/tooling/cli/src/helpers/app_paths.rs index 974b67199..a89eafdf7 100644 --- a/tooling/cli/src/helpers/app_paths.rs +++ b/tooling/cli/src/helpers/app_paths.rs @@ -25,7 +25,14 @@ fn lookup bool>(dir: &Path, checker: F) -> Option { let mut builder = WalkBuilder::new(dir); let _ = builder.add_ignore(default_gitignore); - builder.require_git(false).ignore(false).max_depth(Some(2)); + builder.require_git(false).ignore(false).max_depth(Some( + std::env::var("TAURI_PATH_DEPTH") + .map(|d| { + d.parse() + .expect("`TAURI_PATH_DEPTH` environment variable must be a positive integer") + }) + .unwrap_or(3), + )); for entry in builder.build().flatten() { let path = dir.join(entry.path());