// PopulateNodes read a path and populate the its links given
// the path is a directory else creates a file node.RemoveFromWatchList
PopulateNodes read a path and populate the its links given
the path is a directory else creates a file node.RemoveFromWatchList
// PopulateNodes read a path and populate the its links given // the path is a directory else creates a file node . RemoveFromWatchList
func (vn *VNode) PopulateNodes(s db.Sources, upload bool) error {
	files, err := ioutil.ReadDir(vn.Path)
	if err != nil {
		return err
	}
	var wg sync.WaitGroup
	for _, f := range files {
		abspath := filepath.Join(vn.Path, f.Name())
		if utils.IsHidden(abspath) {
			continue
		}
		nn := vn.NewVNode(abspath)
		if f.IsDir() {
			nn.SetAsDir()
			nn.PopulateNodes(s, upload)
			continue
		}
		source := s.ExtractSource(nn.GetID())
		if nn.Source.IsSame(source) {
			nn.SetSource(source)
			continue
		}
		wg.Add(1)
		go func(vn *VNode) {
			vn.SaveSource()
			wg.Done()
		}(nn)
	}
	wg.Wait()
	return nil
}
func ( vn * VNode ) PopulateNodes ( s db . Sources , upload bool ) error { files , err := ioutil . ReadDir ( vn . Path ) if err != nil { return err } var wg sync . WaitGroup for _ , f := range files { abspath := filepath . Join ( vn . Path , f . Name ( ) ) if utils . IsHidden ( abspath ) { continue } nn := vn . NewVNode ( abspath ) if f . IsDir ( ) { nn . SetAsDir ( ) nn . PopulateNodes ( s , upload ) continue } source := s . ExtractSource ( nn . GetID ( ) ) if nn . Source . IsSame ( source ) { nn . SetSource ( source ) continue } wg . Add ( 1 ) go func ( vn * VNode ) { vn . SaveSource ( ) wg . Done ( ) } ( nn ) } wg . Wait ( ) return nil }
PopulateNodes read a path and populate the its links given
the path is a directory else creates a file node.RemoveFromWatchList
PopulateNodes read a path and populate the its links given the path is a directory else creates a file node . RemoveFromWatchList