implement a 'path-replace' option (#662, #755)

This commit is contained in:
Mike Fährmann
2020-05-24 17:35:25 +02:00
parent 15c3d29062
commit ddc253cf9a
3 changed files with 18 additions and 5 deletions

View File

@@ -725,16 +725,17 @@ class PathFormat():
self.basedirectory = basedir
restrict = extractor.config("path-restrict", "auto")
replace = extractor.config("path-replace", "_")
if restrict == "auto":
restrict = "\\\\|/<>:\"?*" if WINDOWS else "/"
elif restrict == "unix":
restrict = "/"
elif restrict == "windows":
restrict = "\\\\|/<>:\"?*"
self.clean_segment = self._build_cleanfunc(restrict, replace)
remove = extractor.config("path-remove", "\x00-\x1f\x7f")
self.clean_segment = self._build_cleanfunc(restrict, "_")
self.clean_path = self._build_cleanfunc(remove, "")
@staticmethod