MCPcopy Index your code
hub / github.com/coder/coder / dirExists

Function dirExists

cli/dotfiles.go:344–358  ·  view source on GitHub ↗

dirExists checks if the path exists and is a directory.

(name string)

Source from the content-addressed store, hash-verified

342
343// dirExists checks if the path exists and is a directory.
344func dirExists(name string) (bool, error) {
345 fi, err := os.Stat(name)
346 if err != nil {
347 if os.IsNotExist(err) {
348 return false, nil
349 }
350
351 return false, xerrors.Errorf("stat dir: %w", err)
352 }
353 if !fi.IsDir() {
354 return false, xerrors.New("exists but not a directory")
355 }
356
357 return true, nil
358}
359
360// findScript will find the first file that matches the script set.
361func findScript(scriptSet []string, directory string) string {

Callers 1

dotfilesMethod · 0.85

Calls 2

NewMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected