github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/os/exec/lp_windows.go (about)

     1  // Copyright 2010 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package exec
     6  
     7  import (
     8  	"github.com/shogo82148/std/errors"
     9  )
    10  
    11  // ErrNotFoundは、パスの検索が実行可能なファイルを見つけられなかった場合のエラーです。
    12  var ErrNotFound = errors.New("executable file not found in %PATH%")
    13  
    14  // LookPathは、PATH環境変数で指定されたディレクトリ内の実行可能なファイルを検索します。
    15  // LookPathはまた、PATHEXT環境変数を使用して適切な候補をマッチングします。
    16  // もしファイルがスラッシュを含んでいる場合、直接試みられ、PATHは参照されません。
    17  // それ以外の場合、成功すると、結果は絶対パスになります。
    18  //
    19  // Goの古いバージョンでは、LookPathは現在のディレクトリに対する相対パスを返すことができました。
    20  // Go 1.19以降では、LookPathはそのパスとともに、[errors.Is](err, [ErrDot])を満たすエラーを返します。
    21  // 詳細はパッケージのドキュメンテーションを参照してください。
    22  func LookPath(file string) (string, error)