From 068c23153b6ced0e3c90f308de74095a64abc216 Mon Sep 17 00:00:00 2001 From: midays <92722851+midays@users.noreply.github.com> Date: Thu, 30 May 2024 06:47:13 -0400 Subject: [PATCH] add find_mta_directory function (#145) --- src/utils/general.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/utils/general.py b/src/utils/general.py index c3b7abd..2ff1abb 100644 --- a/src/utils/general.py +++ b/src/utils/general.py @@ -167,3 +167,10 @@ def run_command(command): raise Exception(f"failed to run command {command},\n {result.stderr}") return result.stdout + + +def find_mta_directory(extensions_dir_path): + for dir_name in os.listdir(extensions_dir_path): + if os.path.isdir(os.path.join(extensions_dir_path, dir_name)) and "mta" in dir_name.lower(): + return os.path.join(extensions_dir_path, dir_name) + raise Exception(f"No directory containing 'mta' found in {extensions_dir_path}")