mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 00:52:16 -06:00
support cygpaths for mtag binaries
This commit is contained in:
parent
caba4e974c
commit
1881019ede
|
@ -10,7 +10,7 @@ import hashlib
|
|||
import threading
|
||||
|
||||
from .__init__ import WINDOWS
|
||||
from .util import IMPLICATIONS, undot, Pebkac, fsdec, fsenc, statdir, nuprint
|
||||
from .util import IMPLICATIONS, uncyg, undot, Pebkac, fsdec, fsenc, statdir, nuprint
|
||||
|
||||
|
||||
class VFS(object):
|
||||
|
@ -439,8 +439,8 @@ class AuthSrv(object):
|
|||
raise Exception("invalid -v argument: [{}]".format(v_str))
|
||||
|
||||
src, dst, perms = m.groups()
|
||||
if WINDOWS and src.startswith("/"):
|
||||
src = "{}:\\{}".format(src[1], src[3:])
|
||||
if WINDOWS:
|
||||
src = uncyg(src)
|
||||
|
||||
# print("\n".join([src, dst, perms]))
|
||||
src = fsdec(os.path.abspath(fsenc(src)))
|
||||
|
@ -524,9 +524,7 @@ class AuthSrv(object):
|
|||
if vflag == "-":
|
||||
pass
|
||||
elif vflag:
|
||||
if WINDOWS and vflag.startswith("/"):
|
||||
vflag = "{}:\\{}".format(vflag[1], vflag[3:])
|
||||
vol.histpath = vflag
|
||||
vol.histpath = uncyg(vflag) if WINDOWS else vflag
|
||||
elif self.args.hist:
|
||||
for nch in range(len(hid)):
|
||||
hpath = os.path.join(self.args.hist, hid[: nch + 1])
|
||||
|
|
|
@ -8,7 +8,7 @@ import shutil
|
|||
import subprocess as sp
|
||||
|
||||
from .__init__ import PY2, WINDOWS
|
||||
from .util import fsenc, fsdec, REKOBO_LKEY
|
||||
from .util import fsenc, fsdec, uncyg, REKOBO_LKEY
|
||||
|
||||
if not PY2:
|
||||
unicode = str
|
||||
|
@ -44,6 +44,9 @@ class MParser(object):
|
|||
while True:
|
||||
try:
|
||||
bp = os.path.expanduser(args)
|
||||
if WINDOWS:
|
||||
bp = uncyg(bp)
|
||||
|
||||
if os.path.exists(bp):
|
||||
self.bin = bp
|
||||
return
|
||||
|
|
|
@ -648,6 +648,16 @@ def s2hms(s, optional_h=False):
|
|||
return "{}:{:02}:{:02}".format(h, m, s)
|
||||
|
||||
|
||||
def uncyg(path):
|
||||
if not path.startswith("/"):
|
||||
return path
|
||||
|
||||
if len(path) < 3 and path[2] != "/":
|
||||
return path
|
||||
|
||||
return "{}:\\{}".format(path[1], path[3:])
|
||||
|
||||
|
||||
def undot(path):
|
||||
ret = []
|
||||
for node in path.split("/"):
|
||||
|
|
Loading…
Reference in a new issue