mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
push unicode handling into unfrack
This commit is contained in:
parent
bae988ee9b
commit
3afe50dfe2
1 changed files with 2 additions and 2 deletions
|
@ -31,13 +31,13 @@ def unfrackpath(path):
|
|||
example:
|
||||
'$HOME/../../var/mail' becomes '/var/spool/mail'
|
||||
'''
|
||||
return os.path.normpath(os.path.realpath(os.path.expandvars(os.path.expanduser(path))))
|
||||
return os.path.normpath(os.path.realpath(os.path.expandvars(os.path.expanduser(to_bytes(path, errors='strict')))))
|
||||
|
||||
def makedirs_safe(path, mode=None):
|
||||
'''Safe way to create dirs in muliprocess/thread environments'''
|
||||
|
||||
rpath = unfrackpath(path)
|
||||
if not os.path.exists(to_bytes(rpath, errors='strict')):
|
||||
if not os.path.exists(rpath):
|
||||
try:
|
||||
if mode:
|
||||
os.makedirs(rpath, mode)
|
||||
|
|
Loading…
Reference in a new issue