Skip to content

Commit

Permalink
merge #5538: [cookies] optimize _find_most_recently_used_file for exa…
Browse files Browse the repository at this point in the history
…ct profiles
  • Loading branch information
mikf committed May 2, 2024
2 parents bd8e479 + 06d102f commit 625740c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gallery_dl/cookies.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,12 @@ class DATA_BLOB(ctypes.Structure):


def _find_most_recently_used_file(root, filename):
# if the provided root points to an exact profile path
# check if it contains the wanted filename
first_choice = os.path.join(root, filename)
if os.path.exists(first_choice):
return first_choice

# if there are multiple browser profiles, take the most recently used one
paths = []
for curr_root, dirs, files in os.walk(root):
Expand Down

0 comments on commit 625740c

Please sign in to comment.