BT.info
BT.info
Function
returns a snapshot of the current BT runtime information. The snapshot contains basic information such as interpreter version, platform, binary files, startup working directory, and number of parallel threads.
Syntax
BT.info()
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| None | - | No | None | No parameters required. |
Return Value
| Type | Description |
|---|---|
| Object | Returns the runtime information object. See "Return Object Fields" below for fields. |
The fields of the returned object field
BT.info() are generated and cached during the first call, and subsequent calls return clones of the same snapshot.
| Field | Type | Must exist | Description |
|---|---|---|---|
| version | String | Yes | The current BT version, from the Cargo package version at build time. |
| name | String | Yes | The logical name of the current binary. The CLI build is typically bt and the desktop app build is bt_app. |
| os | String | Yes | Current target operating system name, such as windows, linux, macos. |
| arch | String | Yes | Current CPU architecture name, such as x86_64, aarch64. |
| family | String | Yes | The current operating system family, such as windows, unix, wasm. |
| debug | Bool | Yes | Whether the current binary is built as debug. true indicates that debug assertions are enabled. |
| exe_name | String | Yes | The current actual running file name, including the extension; after the user renames the exe, the renamed file name will be returned. Empty string if read fails. |
| exe_ext | String | Yes | Current platform executable file extension, with leading dot. .exe for Windows; platforms without extension return an empty string. |
| lib_ext | String | Yes | Current platform dynamic library extension, with leading dot. For example, it is .dll for Windows, .so for Linux, and .dylib for macOS. |
| pointer_width | Int | Yes | Current target platform pointer width. Common values are 64 or 32. |
| threads | Int | Yes | Number of parallel threads available in the current system. 1 is returned when the read fails. |
| cwd | String | Yes | A snapshot of the working directory when the BT process started, not the live working directory, nor the VM project root directory. Empty string if read fails. |
| exe_path | String | Yes | The full path of the currently running file. Empty string if read fails. |
Examples
info = BT.info() result = info.exe_name // Output example: bt_app.exe print result
Notes
- A snapshot is taken when BT.info() is called for the first time, and subsequent calls return from the cached clone.
-
cwdis a snapshot of the working directory when the BT process starts; to read the project root directory of the current VM, usecur_root(). - In bt_app Bundle mode,
cur_root()may be the temporary expansion directory of resources, such asbt-app-vm-*under system Temp;BT.info().cwdstill represents the process startup working directory. - To get the directory where the current exe is located, use
path(BT.info().exe_path).dirname().