@@ -294,6 +294,9 @@ local function fsIsDirectory(path, option)
294294 return status == ' directory'
295295end
296296
297+ --- @param path fs.path | dummyfs | nil
298+ --- @param option table
299+ --- @return fun (): fs.path | dummyfs | nil
297300local function fsPairs (path , option )
298301 if not path then
299302 return function () end
@@ -421,6 +424,8 @@ local function fsCopy(source, target, option)
421424 return true
422425end
423426
427+ --- @param path dummyfs | fs.path
428+ --- @param option table
424429local function fsCreateDirectories (path , option )
425430 if not path then
426431 return
@@ -444,7 +449,7 @@ local function fileRemove(path, option)
444449 return
445450 end
446451 if fsIsDirectory (path , option ) then
447- for child in fsPairs (path ) do
452+ for child in fsPairs (path , option ) do
448453 fileRemove (child , option )
449454 end
450455 end
@@ -465,7 +470,7 @@ local function fileCopy(source, target, option)
465470 local isExists = fsExists (target , option )
466471 if isDir1 then
467472 if isDir2 or fsCreateDirectories (target , option ) then
468- for filePath in fsPairs (source ) do
473+ for filePath in fsPairs (source , option ) do
469474 local name = filePath :filename ():string ()
470475 fileCopy (filePath , target / name , option )
471476 end
@@ -505,7 +510,7 @@ local function fileSync(source, target, option)
505510 for filePath in fs .pairs (target ) do
506511 fileList [filePath ] = true
507512 end
508- for filePath in fsPairs (source ) do
513+ for filePath in fsPairs (source , option ) do
509514 local name = filePath :filename ():string ()
510515 local targetPath = target / name
511516 fileSync (filePath , targetPath , option )
@@ -518,8 +523,8 @@ local function fileSync(source, target, option)
518523 if isExists then
519524 fileRemove (target , option )
520525 end
521- if fsCreateDirectories (target ) then
522- for filePath in fsPairs (source ) do
526+ if fsCreateDirectories (target , option ) then
527+ for filePath in fsPairs (source , option ) do
523528 local name = filePath :filename ():string ()
524529 fileCopy (filePath , target / name , option )
525530 end
0 commit comments