Added: Search for themes relative to binary

When installed in non-default paths (i.e., not /usr or /usr/local),
bpytop cannot find its themes in $prefix/share/bpytop/themes. Start from
the path of the executable to handle non-default values of $prefix.
pull/422/head
Clemens Lang 2024-09-24 13:31:43 +02:00
parent ac0f6660be
commit 117f61a906
1 changed files with 6 additions and 1 deletions

View File

@ -256,7 +256,12 @@ if os.path.isdir(f'{os.path.dirname(__file__)}/bpytop-themes'):
elif os.path.isdir(f'{os.path.dirname(__file__)}/themes'):
THEME_DIR = f'{os.path.dirname(__file__)}/themes'
else:
for td in ["/usr/local/", "/usr/", "/snap/bpytop/current/usr/"]:
for td in [
os.path.dirname(os.path.dirname(__file__)).rstrip("/") + "/",
"/usr/local/",
"/usr/",
"/snap/bpytop/current/usr/"
]:
if os.path.isdir(f'{td}share/bpytop/themes'):
THEME_DIR = f'{td}share/bpytop/themes'
break