github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/utils/bin_path.go (about)

     1  // Copyright 2019 Keybase, Inc. All rights reserved. Use of this
     2  // source code is governed by the included BSD license.
     3  
     4  package utils
     5  
     6  import (
     7  	"os"
     8  	"path/filepath"
     9  )
    10  
    11  // BinPath returns path to the keybase executable. If the executable path is a
    12  // symlink, the target path is returned.
    13  func BinPath() (string, error) {
    14  	exePath, err := os.Executable()
    15  	if err != nil {
    16  		return "", err
    17  	}
    18  	return filepath.EvalSymlinks(exePath)
    19  }