From a0587555dc0538def04d9b341753acdde741f72e Mon Sep 17 00:00:00 2001 From: dyldonahue Date: Thu, 5 Sep 2024 10:36:34 -0400 Subject: [PATCH] fixed paths --- clang_restage.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/clang_restage.py b/clang_restage.py index 118ea59..5bac1cc 100644 --- a/clang_restage.py +++ b/clang_restage.py @@ -21,17 +21,29 @@ def restage_files(files): print("No files to restage.") def main(): + + current_directory = os.getcwd() + # Get a list of staged files staged_files = get_staged_files() # Run clang-format on staged files - result = subprocess.run(['clang-format', '--style=file', '-i'] + staged_files, + + if "bedded" in current_directory: + result = subprocess.run(['clang-format', '--style=file:clang-format', '-i'] + staged_files, + capture_output=True, text=True) + else: + + clang_format_path = os.path.join(current_directory, 'Drivers', 'Embedded-Base', 'clang-format') + result = subprocess.run(['clang-format', f'--style=file:{clang_format_path}', '-i'] + staged_files, capture_output=True, text=True) if result.returncode == 0: + print("clang-format passed. Restaging files.") restage_files(staged_files) else: - print("clang-format failed. Please fix the issues and commit again.(Most likely, just try commiting again)") + print(current_directory) + print(f"clang-format failed. Please fix the issues and commit again.(Most likely, just try commiting again) {clang_format_path}") sys.exit(1) if __name__ == '__main__':