代表要在存放區中使用的檔案的結構。
成員
basename
string path.basename
目錄名稱
path path.dirname
None
。
存在
bool path.exists
請注意,存取這個欄位「不會」導致路徑受到監控。如要讓存放區規則或模組擴充功能對路徑是否存在保持敏感,請在內容物件上使用 watch()
方法。
get_child
path path.get_child(*relative_paths)
參數
參數 | 說明 |
---|---|
relative_paths
|
必要 要附加至這個路徑的零或多個相對路徑字串,並視需要加入路徑分隔符號。 |
is_dir
bool path.is_dir
請注意,存取這個欄位「不會」導致路徑受到監控。如要讓存放區規則或模組擴充功能判斷路徑是否為目錄或檔案,請在內容物件上使用 watch()
方法。
readdir
list path.readdir(watch='auto')
path
物件。
參數
參數 | 說明 |
---|---|
watch
|
string;
default is 'auto' whether Bazel should watch the list of entries in this directory and refetch the repository or re-evaluate the module extension next time when any changes are detected. 偵測到的變更包括項目建立、刪除和重新命名。請注意,這不會監控目錄中任何項目的內容。 可以是 'yes'、'no' 或 'auto' 字串。如果設為 'auto',Bazel 只會在合法情況下監控這個目錄 (詳情請參閱 |
realpath
path path.realpath