diff --git a/cmd/fs.go b/cmd/fs.go index 83c1b2e5..d0ceae7c 100644 --- a/cmd/fs.go +++ b/cmd/fs.go @@ -110,16 +110,19 @@ func (fs *FSHelper) RemoveFiles(files []string) error { return nil } +// Dir holds information about a directory type Dir struct { localPath string fullPath string } -func (fs *FSHelper) Dir(dir string) (*Dir, error) { +// Directory creates a new Dir struct with the given directory path +func (fs *FSHelper) Directory(dir string) (*Dir, error) { fullPath, err := filepath.Abs(dir) return &Dir{fullPath: fullPath}, err } +// LocalDir creates a new Dir struct based on a path relative to the caller func (fs *FSHelper) LocalDir(dir string) (*Dir, error) { _, filename, _, _ := runtime.Caller(1) fullPath, err := filepath.Abs(filepath.Join(path.Dir(filename), dir)) diff --git a/cmd/templates.go b/cmd/templates.go index 4a609af4..ab28b50e 100644 --- a/cmd/templates.go +++ b/cmd/templates.go @@ -141,7 +141,7 @@ func (t *TemplateHelper) GetTemplateDetails() (map[string]*TemplateDetails, erro func (t *TemplateHelper) GetTemplateFilenames(template *TemplateDetails) (*slicer.StringSlicer, error) { // Get the subdirectory details - templateDir, err := t.fs.Dir(template.Path) + templateDir, err := t.fs.Directory(template.Path) if err != nil { return nil, err }