Skip to content

Commit

Permalink
Added the option to return the pathlib object in the get_file method
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahsoka committed Jul 13, 2021
1 parent 23609e8 commit 36a29f3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions beskar/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,13 @@ def get_number_of_devices(system=True):
else:
return num_of_devices

def get_file(file_path: str, dir='images') -> Union[str, None]:
def get_file(file_path: str, dir='images', path=False) -> Union[pathlib.Path, str, None]:
try:
icon_path = next(pathlib.Path('.').glob(f'**/{dir}/{file_path}'))
return str(icon_path)
if path:
return icon_path
else:
return str(icon_path)
except StopIteration:
# If this happens, somehow the icon was deleted from the install folder
# TODO: Connect to internet and reinstall icon
Expand Down

0 comments on commit 36a29f3

Please sign in to comment.