lib.util.copy(): Copy file types
The file type framework gives mkdir() and put() an ftype argument, but copy() calls them untyped, so the source's node types are discarded at the landing: a destination that applies its own node types receives only the defaults. This commit threads the source's types through. Signed-off-by: Jan Lindemann <jan@janware.com> Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.1.0
This commit is contained in:
parent
a328b01e9a
commit
ca04128a37
1 changed files with 3 additions and 1 deletions
|
|
@ -198,7 +198,7 @@ async def copy(
|
|||
ret: list[str] = []
|
||||
s_st = await ctx.src.stat(src_path)
|
||||
if dst_path and not await ctx.dst.is_dir(dst_path):
|
||||
await ctx.dst.mkdir(dst_path)
|
||||
await ctx.dst.mkdir(dst_path, ftype = s_st.ftype)
|
||||
for dirent in await ctx.src.readdir(src_path):
|
||||
s_path = f'{src_path}/{dirent}' if src_path else dirent
|
||||
d_path = f'{dst_path}/{dirent}' if dst_path else dirent
|
||||
|
|
@ -213,6 +213,7 @@ async def copy(
|
|||
owner = owner,
|
||||
group = group,
|
||||
mode = mode,
|
||||
ftype = s_st.ftype,
|
||||
throw = True,
|
||||
)
|
||||
ret.append(d_path)
|
||||
|
|
@ -242,6 +243,7 @@ async def copy(
|
|||
owner = owner,
|
||||
group = group,
|
||||
mode = mode,
|
||||
ftype = (await ctx.src.stat(src_root)).ftype,
|
||||
throw = True,
|
||||
)
|
||||
return ret
|
||||
|
|
|
|||
Loading…
Reference in a new issue