github.com/haraldrudell/parl@v0.4.176/pfs/abs.go (about)

     1  /*
     2  © 2021–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/)
     3  ISC License
     4  */
     5  
     6  package pfs
     7  
     8  import (
     9  	"path/filepath"
    10  
    11  	"github.com/haraldrudell/parl/perrors"
    12  )
    13  
    14  // Abs ensures a file system path is fully qualified.
    15  // Abs is single-return-value and panics on troubles
    16  func Abs(dir string) (out string) {
    17  	var err error
    18  	if out, err = filepath.Abs(dir); err != nil {
    19  		panic(perrors.Errorf("filepath.Abs: '%w'", err))
    20  	}
    21  	return
    22  }