fix: absolute config path not resolving

+ skip through empty directories in folder browser
+ handle timestamp table error in migration
This commit is contained in:
mungai-njoroge
2024-04-01 11:02:27 +03:00
parent 95a8e9b215
commit 2f6e705c75
9 changed files with 64 additions and 35 deletions
+5 -6
View File
@@ -33,10 +33,9 @@ def create_hash(*args: str, decode=False, limit=10) -> str:
str_ = str_.encode("utf-8")
str_ = hashlib.sha1(str_).hexdigest()
# REVIEW Switched to sha1 hashlib.sha256(str_).hexdigest()
# REVIEW Take the first limit/2 and last limit/2 characters
# This is to avoid collisions
return str_[:limit // 2] + str_[-limit // 2:] if limit % 2 == 0 else str_[:limit // 2] + str_[-limit // 2 - 1:]
# return str_[-limit:]
return (
str_[: limit // 2] + str_[-limit // 2 :]
if limit % 2 == 0
else str_[: limit // 2] + str_[-limit // 2 - 1 :]
)
+4 -1
View File
@@ -1,7 +1,7 @@
import os
def get_xdg_config_dir():
def get_xdg_config_dir() -> str:
"""
Returns the XDG_CONFIG_HOME environment variable if it exists, otherwise
returns the default config directory. If none of those exist, returns the
@@ -19,3 +19,6 @@ def get_xdg_config_dir():
return alt_dir
except TypeError:
return os.path.expanduser("~")
# Fallback to current directory
return os.path.abspath(".")