Skip to content

Commit f268b3d

Browse files
authored
fix(cli): Tauri project path resolution, closes #3527 #12779 (#12871)
1 parent 755533c commit f268b3d

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri-cli": patch:bug
3+
"@tauri-apps/cli": patch:bug
4+
---
5+
6+
Ignore parent .gitignore files on the Tauri project path detection.

crates/tauri-cli/src/helpers/app_paths.rs

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pub fn walk_builder(path: &Path) -> WalkBuilder {
3939
let mut builder = WalkBuilder::new(path);
4040
builder.add_custom_ignore_filename(".taurignore");
4141
builder.git_global(false);
42+
builder.parents(false);
4243
let _ = builder.add_ignore(default_gitignore);
4344
builder
4445
}
@@ -94,20 +95,36 @@ fn env_tauri_frontend_path() -> Option<PathBuf> {
9495
pub fn resolve_tauri_dir() -> Option<PathBuf> {
9596
let src_dir = env_tauri_app_path().or_else(|| current_dir().ok())?;
9697

97-
if src_dir.join(ConfigFormat::Json.into_file_name()).exists()
98-
|| src_dir.join(ConfigFormat::Json5.into_file_name()).exists()
99-
|| src_dir.join(ConfigFormat::Toml.into_file_name()).exists()
100-
{
101-
return Some(src_dir);
98+
for standard_tauri_path in [src_dir.clone(), src_dir.join("src-tauri")] {
99+
if standard_tauri_path
100+
.join(ConfigFormat::Json.into_file_name())
101+
.exists()
102+
|| standard_tauri_path
103+
.join(ConfigFormat::Json5.into_file_name())
104+
.exists()
105+
|| standard_tauri_path
106+
.join(ConfigFormat::Toml.into_file_name())
107+
.exists()
108+
{
109+
log::debug!(
110+
"Found Tauri project inside {} on early lookup",
111+
standard_tauri_path.display()
112+
);
113+
return Some(standard_tauri_path);
114+
}
102115
}
103116

117+
log::debug!("resolving Tauri directory from {}", src_dir.display());
118+
104119
lookup(&src_dir, |path| {
105120
folder_has_configuration_file(Target::Linux, path) || is_configuration_file(Target::Linux, path)
106121
})
107122
.map(|p| {
108123
if p.is_dir() {
124+
log::debug!("Found Tauri project directory {}", p.display());
109125
p
110126
} else {
127+
log::debug!("Found Tauri project configuration file {}", p.display());
111128
p.parent().unwrap().to_path_buf()
112129
}
113130
})
@@ -142,6 +159,11 @@ pub fn resolve_frontend_dir() -> Option<PathBuf> {
142159
return Some(frontend_dir);
143160
}
144161

162+
log::debug!(
163+
"resolving frontend directory from {}",
164+
frontend_dir.display()
165+
);
166+
145167
lookup(&frontend_dir, |path| {
146168
if let Some(file_name) = path.file_name() {
147169
file_name == OsStr::new("package.json")

0 commit comments

Comments
 (0)