Clean Path (#1299)

* clean path

* clean path
This commit is contained in:
XXXXRT666
2024-07-13 19:17:46 +08:00
committed by GitHub
parent c4272cd1c0
commit 0a3a1e4505
3 changed files with 9 additions and 9 deletions

View File

@@ -25,7 +25,9 @@ def load_audio(file, sr):
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':
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")