mirror of
https://github.com/xzb23/check_duplicate_files.git
synced 2026-11-24 18:45:31 +08:00
优化提示信息
This commit is contained in:
5 files changed
+41
-12
No files matched your search
@@ -3,11 +3,11 @@ import config
|
||||
|
||||
|
||||
def formatting_path(path: str) -> str:
|
||||
path = path.strip()
|
||||
path = path.replace("\\", "/")
|
||||
if path[-1] != "/":
|
||||
path += "/"
|
||||
return path
|
||||
path = path.strip()
|
||||
path = path.replace("\\", "/")
|
||||
if path[-1] != "/":
|
||||
path += "/"
|
||||
return path
|
||||
|
||||
def get_exe_dir():
|
||||
if getattr(sys, "frozen", False):
|
||||
@@ -30,7 +30,7 @@ def get_config(config_key: str):
|
||||
config.configdir_path = formatting_path(configdir_path)
|
||||
config_path = config.configdir_path + config_key
|
||||
if not (os.path.isfile(config_path)):
|
||||
return None
|
||||
return None
|
||||
with open(config_path, "r", encoding="utf-8") as conf:
|
||||
conf_v = conf.read().strip()
|
||||
return conf_v
|
||||
@@ -39,4 +39,13 @@ def get_config(config_key: str):
|
||||
def safe_format(fmt_str: str, *args) -> str:
|
||||
try:
|
||||
return fmt_str.format(*args)
|
||||
except: return "__langerr__"
|
||||
except: return "__langerr__"
|
||||
|
||||
def add_unit(num: int) -> str:
|
||||
for unit in config.unit_list:
|
||||
if num >= 1024:
|
||||
num //= 1024
|
||||
else:
|
||||
num = str(num)
|
||||
break
|
||||
return num+unit
|
||||
Reference in new issue
Block a user