Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/ignore-parent-gitignore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri-cli": patch:bug
"@tauri-apps/cli": patch:bug
---

Ignore parent .gitignore files on the Tauri project path detection.
32 changes: 27 additions & 5 deletions crates/tauri-cli/src/helpers/app_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub fn walk_builder(path: &Path) -> WalkBuilder {
let mut builder = WalkBuilder::new(path);
builder.add_custom_ignore_filename(".taurignore");
builder.git_global(false);
builder.parents(false);
let _ = builder.add_ignore(default_gitignore);
builder
}
Expand Down Expand Up @@ -94,20 +95,36 @@ fn env_tauri_frontend_path() -> Option<PathBuf> {
pub fn resolve_tauri_dir() -> Option<PathBuf> {
let src_dir = env_tauri_app_path().or_else(|| current_dir().ok())?;

if src_dir.join(ConfigFormat::Json.into_file_name()).exists()
|| src_dir.join(ConfigFormat::Json5.into_file_name()).exists()
|| src_dir.join(ConfigFormat::Toml.into_file_name()).exists()
{
return Some(src_dir);
for standard_tauri_path in [src_dir.clone(), src_dir.join("src-tauri")] {
if standard_tauri_path
.join(ConfigFormat::Json.into_file_name())
.exists()
|| standard_tauri_path
.join(ConfigFormat::Json5.into_file_name())
.exists()
|| standard_tauri_path
.join(ConfigFormat::Toml.into_file_name())
.exists()
{
log::debug!(
"Found Tauri project inside {} on early lookup",
standard_tauri_path.display()
);
return Some(standard_tauri_path);
}
}

log::debug!("resolving Tauri directory from {}", src_dir.display());

lookup(&src_dir, |path| {
folder_has_configuration_file(Target::Linux, path) || is_configuration_file(Target::Linux, path)
})
.map(|p| {
if p.is_dir() {
log::debug!("Found Tauri project directory {}", p.display());
p
} else {
log::debug!("Found Tauri project configuration file {}", p.display());
p.parent().unwrap().to_path_buf()
}
})
Expand Down Expand Up @@ -142,6 +159,11 @@ pub fn resolve_frontend_dir() -> Option<PathBuf> {
return Some(frontend_dir);
}

log::debug!(
"resolving frontend directory from {}",
frontend_dir.display()
);

lookup(&frontend_dir, |path| {
if let Some(file_name) = path.file_name() {
file_name == OsStr::new("package.json")
Expand Down