gitlab.com/evatix-go/core@v1.3.55/chmodhelper/GetFilteredExistsFilesInfosOnly.go (about)

     1  package chmodhelper
     2  
     3  import (
     4  	"os"
     5  
     6  	"gitlab.com/evatix-go/core/constants"
     7  	"gitlab.com/evatix-go/core/internal/fsinternal"
     8  )
     9  
    10  // GetFilteredExistsFilesInfosOnly
    11  //
    12  // Warning: File related errors will be swallowed
    13  func GetFilteredExistsFilesInfosOnly(
    14  	locations ...string,
    15  ) map[string]os.FileInfo {
    16  	if len(locations) == 0 {
    17  		return map[string]os.FileInfo{}
    18  	}
    19  
    20  	results := make(
    21  		map[string]os.FileInfo,
    22  		len(locations)+constants.Capacity5)
    23  
    24  	for _, location := range locations {
    25  		info, isExist, _ :=
    26  			fsinternal.GetPathExistStat(location)
    27  
    28  		if isExist && info != nil {
    29  			results[location] = info
    30  		}
    31  	}
    32  
    33  	return results
    34  }