BT.info

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

Parameters

ParametersTypeRequiredDefault valueDescription
None-NoNoneNo parameters required.

Return Value

TypeDescription
ObjectReturns 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.

FieldTypeMust existDescription
versionStringYesThe current BT version, from the Cargo package version at build time.
nameStringYesThe logical name of the current binary. The CLI build is typically bt and the desktop app build is bt_app.
osStringYesCurrent target operating system name, such as windows, linux, macos.
archStringYesCurrent CPU architecture name, such as x86_64, aarch64.
familyStringYesThe current operating system family, such as windows, unix, wasm.
debugBoolYesWhether the current binary is built as debug. true indicates that debug assertions are enabled.
exe_nameStringYesThe 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_extStringYesCurrent platform executable file extension, with leading dot. .exe for Windows; platforms without extension return an empty string.
lib_extStringYesCurrent platform dynamic library extension, with leading dot. For example, it is .dll for Windows, .so for Linux, and .dylib for macOS.
pointer_widthIntYesCurrent target platform pointer width. Common values are 64 or 32.
threadsIntYesNumber of parallel threads available in the current system. 1 is returned when the read fails.
cwdStringYesA 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_pathStringYesThe full path of the currently running file. Empty string if read fails.

Examples

Notes

  • A snapshot is taken when BT.info() is called for the first time, and subsequent calls return from the cached clone.
  • cwd is a snapshot of the working directory when the BT process starts; to read the project root directory of the current VM, use cur_root().
  • In bt_app Bundle mode, cur_root() may be the temporary expansion directory of resources, such as bt-app-vm-* under system Temp; BT.info().cwd still represents the process startup working directory.
  • To get the directory where the current exe is located, use path(BT.info().exe_path).dirname().