Skip to content

Commit

Permalink
Refine version matching logic in find_crest_executable to improve acc…
Browse files Browse the repository at this point in the history
…uracy and handle additional version formats
  • Loading branch information
calvinp0 committed Dec 24, 2024
1 parent d79fd0c commit ac77e51
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions arc/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,11 +822,13 @@ def find_highest_version_in_directory(directory, name_contains):
for root, _, files in os.walk(directory):
for file in files:
if name_contains.lower() in file.lower():
match = re.search(r"(\d+\.\d+(\.\d+)?)", file) # Match version patterns like 1.0, 1.0.1
version = tuple(map(int, match.group(1).split('.'))) if match else (0,)
if highest_version is None or version > highest_version:
highest_version = version
highest_version_path = os.path.join(root, file)
match = re.search(r"(\d+\.\d+(\.\d+)*)", file) # Match version patterns like 1.0, 1.0.1
if match:
version_str = match.group(1)
version = tuple(map(int, version_str.split('.')))
if highest_version is None or version > highest_version:
highest_version = version
highest_version_path = os.path.join(root, file)

return highest_version_path

Expand Down

0 comments on commit ac77e51

Please sign in to comment.