diff --git a/.changes/cli-fix-gitignored-conf-lookup.md b/.changes/cli-fix-gitignored-conf-lookup.md new file mode 100644 index 000000000..7d5d5d11d --- /dev/null +++ b/.changes/cli-fix-gitignored-conf-lookup.md @@ -0,0 +1,6 @@ +--- +"cli.rs": patch +"cli.js": patch +--- + +Check if `$CWD/src-tauri/tauri.conf.json` exists before walking through the file tree to find the tauri dir in case the whole project is gitignored. diff --git a/tooling/cli/src/helpers/app_paths.rs b/tooling/cli/src/helpers/app_paths.rs index 8a708c15d..a59f845fd 100644 --- a/tooling/cli/src/helpers/app_paths.rs +++ b/tooling/cli/src/helpers/app_paths.rs @@ -56,7 +56,15 @@ fn lookup bool>(dir: &Path, checker: F) -> Option

PathBuf { - lookup(¤t_dir().expect("failed to read cwd"), |path, file_type| if file_type.is_dir() { + let cwd = current_dir().expect("failed to read cwd"); + + if cwd.join("src-tauri/tauri.conf.json").exists() + || cwd.join("src-tauri/tauri.conf.json5").exists() + { + return cwd.join("src-tauri/"); + } + + lookup(&cwd, |path, file_type| if file_type.is_dir() { path.join("tauri.conf.json").exists() || path.join("tauri.conf.json5").exists() } else if let Some(file_name) = path.file_name() { file_name == OsStr::new("tauri.conf.json") || file_name == OsStr::new("tauri.conf.json5")