@@ -171,6 +171,7 @@ function dfs:string()
171
171
return self .path
172
172
end
173
173
174
+ --- @return fun (): dummyfs ?
174
175
function dfs :listDirectory ()
175
176
local dir = self :_open ()
176
177
if type (dir ) ~= ' table' then
263
264
264
265
--- @param path string | fs.path | dummyfs
265
266
--- @param option table
266
- --- @return fs.path ?
267
+ --- @return fs.path | dummyfs ?
267
268
local function fsAbsolute (path , option )
268
269
if type (path ) == ' string' then
269
270
local suc , res = pcall (fs .path , path )
@@ -459,7 +460,7 @@ local function fileRemove(path, option)
459
460
end
460
461
461
462
--- @param source fs.path | dummyfs ?
462
- --- @param target fs.path ?
463
+ --- @param target fs.path | dummyfs ?
463
464
--- @param option table
464
465
local function fileCopy (source , target , option )
465
466
if not source or not target then
@@ -495,7 +496,7 @@ local function fileCopy(source, target, option)
495
496
end
496
497
497
498
--- @param source fs.path | dummyfs ?
498
- --- @param target fs.path ?
499
+ --- @param target fs.path | dummyfs ?
499
500
--- @param option table
500
501
local function fileSync (source , target , option )
501
502
if not source or not target then
@@ -507,8 +508,16 @@ local function fileSync(source, target, option)
507
508
if isDir1 then
508
509
if isDir2 then
509
510
local fileList = m .fileList ()
510
- for filePath in fs .pairs (target ) do
511
- fileList [filePath ] = true
511
+ if type (target ) == ' table' then
512
+ --- @cast target dummyfs
513
+ for filePath in target :listDirectory () do
514
+ fileList [filePath ] = true
515
+ end
516
+ else
517
+ --- @cast target fs.path
518
+ for filePath in fs .pairs (target ) do
519
+ fileList [filePath ] = true
520
+ end
512
521
end
513
522
for filePath in fsPairs (source , option ) do
514
523
local name = filePath :filename ():string ()
0 commit comments