bos abspath

This commit is contained in:
ed 2021-07-26 23:53:13 +02:00
parent 72574da834
commit 23b20ff4a6
2 changed files with 7 additions and 3 deletions

View file

@ -369,7 +369,7 @@ class AuthSrv(object):
raise Exception('invalid mountpoint "{}"'.format(vol_dst)) raise Exception('invalid mountpoint "{}"'.format(vol_dst))
# cfg files override arguments and previous files # cfg files override arguments and previous files
vol_src = fsdec(os.path.abspath(fsenc(vol_src))) vol_src = bos.path.abspath(vol_src)
vol_dst = vol_dst.strip("/") vol_dst = vol_dst.strip("/")
mount[vol_dst] = vol_src mount[vol_dst] = vol_src
daxs[vol_dst] = AXS() daxs[vol_dst] = AXS()
@ -461,7 +461,7 @@ class AuthSrv(object):
src = uncyg(src) src = uncyg(src)
# print("\n".join([src, dst, perms])) # print("\n".join([src, dst, perms]))
src = fsdec(os.path.abspath(fsenc(src))) src = bos.path.abspath(src)
dst = dst.strip("/") dst = dst.strip("/")
mount[dst] = src mount[dst] = src
daxs[dst] = AXS() daxs[dst] = AXS()
@ -492,7 +492,7 @@ class AuthSrv(object):
if not mount: if not mount:
# -h says our defaults are CWD at root and read/write for everyone # -h says our defaults are CWD at root and read/write for everyone
axs = AXS(["*"], ["*"], None, None) axs = AXS(["*"], ["*"], None, None)
vfs = VFS(self.log_func, os.path.abspath("."), "", axs, {}) vfs = VFS(self.log_func, bos.path.abspath("."), "", axs, {})
elif "" not in mount: elif "" not in mount:
# there's volumes but no root; make root inaccessible # there's volumes but no root; make root inaccessible
vfs = VFS(self.log_func, None, "", AXS(), {}) vfs = VFS(self.log_func, None, "", AXS(), {})

View file

@ -5,6 +5,10 @@ import os
from ..util import fsenc, fsdec from ..util import fsenc, fsdec
def abspath(p):
return fsdec(os.path.abspath(fsenc(p)))
def exists(p): def exists(p):
return os.path.exists(fsenc(p)) return os.path.exists(fsenc(p))