Skip to content

Commit bd8f3e2

Browse files
authored
fix(cli): manual config lookup to handle gitignored folders, fixes #3527 (#4224)
1 parent 569fbd8 commit bd8f3e2

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"cli.rs": patch
3+
"cli.js": patch
4+
---
5+
6+
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.

tooling/cli/src/helpers/app_paths.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,15 @@ fn lookup<F: Fn(&PathBuf, FileType) -> bool>(dir: &Path, checker: F) -> Option<P
5656
}
5757

5858
fn get_tauri_dir() -> PathBuf {
59-
lookup(&current_dir().expect("failed to read cwd"), |path, file_type| if file_type.is_dir() {
59+
let cwd = current_dir().expect("failed to read cwd");
60+
61+
if cwd.join("src-tauri/tauri.conf.json").exists()
62+
|| cwd.join("src-tauri/tauri.conf.json5").exists()
63+
{
64+
return cwd.join("src-tauri/");
65+
}
66+
67+
lookup(&cwd, |path, file_type| if file_type.is_dir() {
6068
path.join("tauri.conf.json").exists() || path.join("tauri.conf.json5").exists()
6169
} else if let Some(file_name) = path.file_name() {
6270
file_name == OsStr::new("tauri.conf.json") || file_name == OsStr::new("tauri.conf.json5")

0 commit comments

Comments
 (0)