261261
262262--- @param path string | fspath
263263--- @param option table
264- --- @return fspath
264+ --- @return fspath ?
265265local function fsAbsolute (path , option )
266266 if type (path ) == ' string' then
267267 local suc , res = pcall (fs .path , path )
@@ -451,6 +451,9 @@ local function fileRemove(path, option)
451451 end
452452end
453453
454+ --- @param source fspath ?
455+ --- @param target fspath ?
456+ --- @param option table
454457local function fileCopy (source , target , option )
455458 if not source or not target then
456459 return
@@ -462,7 +465,7 @@ local function fileCopy(source, target, option)
462465 if isDir2 or fsCreateDirectories (target , option ) then
463466 for filePath in fsPairs (source ) do
464467 local name = filePath :filename ():string ()
465- fileCopy (filePath , target / name , option )
468+ fileCopy (filePath , target / name --[[ @as fspath ]] , option )
466469 end
467470 end
468471 else
@@ -513,7 +516,7 @@ local function fileSync(source, target, option)
513516 if fsCreateDirectories (target ) then
514517 for filePath in fsPairs (source ) do
515518 local name = filePath :filename ():string ()
516- fileCopy (filePath , target / name , option )
519+ fileCopy (filePath , target / name --[[ @as fspath ]] , option )
517520 end
518521 end
519522 end
@@ -595,10 +598,10 @@ end
595598--- @return table
596599function m .fileCopy (source , target , option )
597600 option = buildOption (option )
598- source = fsAbsolute (source , option )
599- target = fsAbsolute (target , option )
601+ local fsSource = fsAbsolute (source , option )
602+ local fsTarget = fsAbsolute (target , option )
600603
601- fileCopy (source , target , option )
604+ fileCopy (fsSource , fsTarget , option )
602605
603606 return option
604607end
@@ -609,10 +612,10 @@ end
609612--- @return table
610613function m .fileSync (source , target , option )
611614 option = buildOption (option )
612- source = fsAbsolute (source , option )
613- target = fsAbsolute (target , option )
615+ local fsSource = fsAbsolute (source , option )
616+ local fsTarget = fsAbsolute (target , option )
614617
615- fileSync (source , target , option )
618+ fileSync (fsSource , fsTarget , option )
616619
617620 return option
618621end
0 commit comments