decred.org/dcrdex@v1.0.5/client/app/fileurl.go (about)

     1  //go:build !darwin && !windows
     2  
     3  package app
     4  
     5  import (
     6  	"path/filepath"
     7  )
     8  
     9  func FilePathToURL(name string) (string, error) {
    10  	path, err := filepath.Abs(name)
    11  	if err != nil { // can't pwd if name was relative, probably impossible
    12  		return "", err
    13  	}
    14  	return "file://" + path, nil
    15  }