Skip to content

Commit

Permalink
mformat: try to detect meson.format in parent directories
Browse files Browse the repository at this point in the history
  • Loading branch information
wrvsrx committed Jan 23, 2025
1 parent 0b9baf5 commit 3d81b98
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mesonbuild/mformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,9 +975,12 @@ def run(options: argparse.Namespace) -> int:

sources: T.List[Path] = options.sources.copy() or [Path(build_filename)]
if not options.configuration:
default_config_path = sources[0].parent / 'meson.format'
if default_config_path.exists():
options.configuration = default_config_path
current_path = Path.cwd()
for parent in [current_path] + list(current_path.parents):
target = parent / 'meson.format'
if target.exists() and target.is_file():
options.configuration = target

formatter = Formatter(options.configuration, options.editor_config, options.recursive)

while sources:
Expand Down

0 comments on commit 3d81b98

Please sign in to comment.