(absPath string, stat os.FileInfo, localState map[string]*FileInformation, isSymlink, ignore bool)
| 338 | } |
| 339 | |
| 340 | func (i *initialSyncer) calculateLocalDirState(absPath string, stat os.FileInfo, localState map[string]*FileInformation, isSymlink, ignore bool) error { |
| 341 | relativePath := getRelativeFromFullPath(absPath, i.o.LocalPath) |
| 342 | files, err := os.ReadDir(absPath) |
| 343 | if err != nil { |
| 344 | i.o.Log.Infof("Couldn't read dir %s: %v", absPath, err) |
| 345 | return nil |
| 346 | } |
| 347 | |
| 348 | if relativePath != "" && !ignore && stat != nil { |
| 349 | localState[relativePath] = &FileInformation{ |
| 350 | Name: relativePath, |
| 351 | Mtime: stat.ModTime().Unix(), |
| 352 | MtimeNano: stat.ModTime().UnixNano(), |
| 353 | Size: stat.Size(), |
| 354 | Mode: stat.Mode(), |
| 355 | IsDirectory: true, |
| 356 | IsSymbolicLink: stat.Mode()&os.ModeSymlink != 0, |
| 357 | ResolvedLink: isSymlink, |
| 358 | Files: len(files), |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | for _, dirEntry := range files { |
| 363 | f, err := dirEntry.Info() |
| 364 | if err != nil { |
| 365 | continue |
| 366 | } |
| 367 | |
| 368 | if fsutil.IsRecursiveSymlink(f, filepath.Join(absPath, f.Name())) { |
| 369 | i.o.Log.Debugf("Found recursive symlink at %v", filepath.Join(absPath, f.Name())) |
| 370 | continue |
| 371 | } |
| 372 | |
| 373 | err = i.CalculateLocalState(filepath.Join(absPath, f.Name()), localState, ignore) |
| 374 | if err != nil { |
| 375 | return errors.Wrap(err, f.Name()) |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | return nil |
| 380 | } |
| 381 | |
| 382 | type action int |
| 383 |
no test coverage detected