// readDirFromWorkingDir listst the directory content relative to the // configured WorkingDir. func readDirFromWorkingDir(i interface{}) ([]os.FileInfo, error) { path := cast.ToString(i) list, err := afero.ReadDir(hugofs.WorkingDir(), path) if err != nil { return nil, fmt.Errorf("Failed to read Directory %s with error message %s", path, err) } return list, nil }
// readFileFromWorkingDir reads the file named by filename relative to the // configured WorkingDir. // It returns the contents as a string. // There is a upper size limit set at 1 megabytes. func readFileFromWorkingDir(i interface{}) (string, error) { return readFile(hugofs.WorkingDir(), cast.ToString(i)) }