clean path

This commit is contained in:
XXXXRT666 2024-07-12 23:58:58 +08:00
parent 8d0cf0f8a9
commit d776ff6bd3

View File

@ -25,7 +25,9 @@ def load_audio(file, sr):
return np.frombuffer(out, np.float32).flatten() return np.frombuffer(out, np.float32).flatten()
def clean_path(path_str): def clean_path(path_str:str):
if path_str.endswith(('\\','/')):
return clean_path(path_str[0:-1])
if platform.system() == 'Windows': if platform.system() == 'Windows':
path_str = path_str.replace('/', '\\') path_str = path_str.replace('/', '\\')
return path_str.strip(" ").strip('"').strip("\n").strip('"').strip(" ").strip("\u202a") return path_str.strip(" ").strip('"').strip("\n").strip('"').strip(" ").strip("\u202a")