Replace windows file/folder problem characters

This commit is contained in:
Ade
2017-09-26 11:06:34 +13:00
parent 9b3d7f3bbb
commit 0828643c09

View File

@@ -22,6 +22,7 @@ import time
import sys
import tempfile
import glob
from unidecode import unidecode
from beets import logging as beetslogging
import six
@@ -223,7 +224,11 @@ def replace_illegal_chars(string, type="file"):
if type == "file":
string = re.sub('[\?"*:|<>/]', '_', string)
if type == "folder":
string = re.sub('[:\?<>"|]', '_', string)
string = re.sub('[:\?<>"|*]', '_', string)
# Asciify windows file/folder names
if sys.platform == "win32":
string = unidecode(string)
return string