fix windows symlink creation
This commit is contained in:
parent
415e61c3c9
commit
5e9bc1127d
@ -749,7 +749,7 @@ def run_argparse(argv: list[str], formatter: Any, retry: bool) -> argparse.Names
|
|||||||
ap2.add_argument("--no-scandir", action="store_true", help="disable scandir; instead using listdir + stat on each file")
|
ap2.add_argument("--no-scandir", action="store_true", help="disable scandir; instead using listdir + stat on each file")
|
||||||
ap2.add_argument("--no-fastboot", action="store_true", help="wait for up2k indexing before starting the httpd")
|
ap2.add_argument("--no-fastboot", action="store_true", help="wait for up2k indexing before starting the httpd")
|
||||||
ap2.add_argument("--no-htp", action="store_true", help="disable httpserver threadpool, create threads as-needed instead")
|
ap2.add_argument("--no-htp", action="store_true", help="disable httpserver threadpool, create threads as-needed instead")
|
||||||
ap2.add_argument("--stackmon", metavar="P,S", type=u, help="write stacktrace to Path every S second, for example --stackmon=./st/%Y-%m/%d/%H%M.xz,60")
|
ap2.add_argument("--stackmon", metavar="P,S", type=u, help="write stacktrace to Path every S second, for example --stackmon=./st/%%Y-%%m/%%d/%%H%%M.xz,60")
|
||||||
ap2.add_argument("--log-thrs", metavar="SEC", type=float, help="list active threads every SEC")
|
ap2.add_argument("--log-thrs", metavar="SEC", type=float, help="list active threads every SEC")
|
||||||
ap2.add_argument("--log-fk", metavar="REGEX", type=u, default="", help="log filekey params for files where path matches REGEX; '.' (a single dot) = all files")
|
ap2.add_argument("--log-fk", metavar="REGEX", type=u, default="", help="log filekey params for files where path matches REGEX; '.' (a single dot) = all files")
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
@ -2133,13 +2133,9 @@ class Up2k(object):
|
|||||||
raise OSError(38, "filesystem does not have st_dev")
|
raise OSError(38, "filesystem does not have st_dev")
|
||||||
elif fs1 == fs2:
|
elif fs1 == fs2:
|
||||||
# same fs; make symlink as relative as possible
|
# same fs; make symlink as relative as possible
|
||||||
v = []
|
spl = r"[\\/]" if WINDOWS else "/"
|
||||||
for p in [src, dst]:
|
nsrc = re.split(spl, src)
|
||||||
if WINDOWS:
|
ndst = re.split(spl, dst)
|
||||||
p = p.replace("\\", "/")
|
|
||||||
v.append(p.split("/"))
|
|
||||||
|
|
||||||
nsrc, ndst = v
|
|
||||||
nc = 0
|
nc = 0
|
||||||
for a, b in zip(nsrc, ndst):
|
for a, b in zip(nsrc, ndst):
|
||||||
if a != b:
|
if a != b:
|
||||||
@ -2150,6 +2146,10 @@ class Up2k(object):
|
|||||||
hops = len(ndst[nc:]) - 1
|
hops = len(ndst[nc:]) - 1
|
||||||
lsrc = "../" * hops + "/".join(zsl)
|
lsrc = "../" * hops + "/".join(zsl)
|
||||||
|
|
||||||
|
if WINDOWS:
|
||||||
|
lsrc = lsrc.replace("/", "\\")
|
||||||
|
ldst = ldst.replace("/", "\\")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self.args.hardlink:
|
if self.args.hardlink:
|
||||||
os.link(fsenc(src), fsenc(dst))
|
os.link(fsenc(src), fsenc(dst))
|
||||||
|
Loading…
Reference in New Issue
Block a user