Functionality related to game and user/system environment, such as locating installation directories and detecting language and codepage.
Note that most functions here rely on caching to avoid repeated filesystem access; if you modify environment variables or configuration files during runtime, you may need to clear the relevant function caches using functools.cache_clear(). This will typically only be necessary during testing, is not considered part of the public API, and will likely change in a future version.
| Class | |
No class docstring; 0/43 constant, 1/1 class method documented |
| Function | get |
Detect the codepage used by the NWN installation based on the user language. |
| Function | get |
Find the first matching NWN installation directory. Currently only supports searching for Steam installs. |
| Function | get |
Get the path to the language data directory inside the NWN installation. |
| Function | get |
Detect the language of the NWN installation based on system locale or configuration inside game settings. |
| Function | get |
Get a setting from the user's settings.tml file. |
| Function | get |
Find the current user NWN directory. |
| Function | resolve |
Get the path for a given NWN alias from nwn.ini, or return the default value if not found. |
| Function | _get |
Undocumented |
| Function | _get |
Undocumented |
Detect the codepage used by the NWN installation based on the user language.
The codepage can be overridden by setting the NWN_CODEPAGE environment variable.
| Returns | |
CodePage | The codepage specified in settings.tml, or defaults based on language. |
Find the first matching NWN installation directory. Currently only supports searching for Steam installs.
The search can be overridden by setting the NWN_ROOT environment variable.
| Returns | |
Path | The path to the NWN root directory. |
| Raises | |
FileNotFoundError | If the directory cannot be found. |
Get the path to the language data directory inside the NWN installation.
| Returns | |
Path | The path to the language data directory. |
| Raises | |
FileNotFoundError | If the installation directory cannot be found. |
Detect the language of the NWN installation based on system locale or configuration inside game settings.
| Returns | |
Language | The detected Language enum value, or english by default. |
Get a setting from the user's settings.tml file.
| Parameters | |
key:str | The setting key to look up, in dot notation (e.g. "game.language.override"). |
| Returns | |
Any | The setting value, or None if not found. |
| Raises | |
FileNotFoundError | If the user directory cannot be found. This function requires a user directory set up already. |
Find the current user NWN directory.
The search can be overridden by setting the NWN_HOME or NWN_USER_DIRECTORY environment variables.
| Returns | |
Path | The path to the NWN user directory. |
| Raises | |
FileNotFoundError | If the directory cannot be found. |
Get the path for a given NWN alias from nwn.ini, or return the default value if not found.
| Parameters | |
alias:str | Alias | The alias to look up. |
| Returns | |
Path | The resolved path for the alias, or the default value. |
| Raises | |
FileNotFoundError | If the user directory cannot be found. This function requires a user directory set up already. |