mirror of
https://github.com/marty-oehme/scripts.git
synced 2024-12-22 07:58:08 +00:00
Delete safe_path.py
This commit is contained in:
parent
b1ab0a8107
commit
090ee8c64f
1 changed files with 0 additions and 24 deletions
|
@ -1,24 +0,0 @@
|
||||||
import platform
|
|
||||||
|
|
||||||
|
|
||||||
def filename(filename):
|
|
||||||
"""
|
|
||||||
Replace the characters in file name that are not allowed in current OS
|
|
||||||
:param filename: file name
|
|
||||||
:return: file name which is safe to use in current OS
|
|
||||||
"""
|
|
||||||
if platform.system() == 'Linux':
|
|
||||||
safe_filename = filename.replace('/', '-')
|
|
||||||
elif platform.system() == 'Darwin':
|
|
||||||
safe_filename = filename.replace('/', '-').replace(':', '-')
|
|
||||||
else:
|
|
||||||
safe_filename = filename
|
|
||||||
for char in (':', '/', '\\', '|'):
|
|
||||||
safe_filename = safe_filename.replace(char, '-')
|
|
||||||
for char in ('?', '*'):
|
|
||||||
safe_filename = safe_filename.replace(char, '')
|
|
||||||
safe_filename = safe_filename.replace('<', '(')
|
|
||||||
safe_filename = safe_filename.replace('>', ')')
|
|
||||||
safe_filename = safe_filename.replace('"', "'")
|
|
||||||
|
|
||||||
return safe_filename
|
|
Loading…
Reference in a new issue