general

Provide general utility functions for the application.

Includes startup checks, timestamp generation, and interactive prompts.

bedrock_server_manager.utils.general.startup_checks(settings: Any) → None

Performs initial checks and setup when the application starts.

  • Verifies Python version compatibility (>= 3.11).

  • Creates essential application directories based on settings.

Parameters:

settings – Settings instance or object providing paths configuration.

bedrock_server_manager.utils.general.run_async(coro)

Run a coroutine from synchronous CLI code.

The legacy active-loop path blocks its caller and uses another event loop. Async consumers must await their coroutine directly; loop-bound application resources must remain on their owning loop.

class bedrock_server_manager.utils.general.ReentrantAsyncLock

A re-entrant lock for asyncio tasks to prevent deadlocks when a task re-enters locked operations.

bedrock_server_manager.utils.general.get_timestamp() → str

Generates a timestamp string suitable for filenames or logging.

Returns:

The current UTC timestamp in YYYYMMDD_HHMMSS format.

async bedrock_server_manager.utils.general.list_content_files(content_dir: str | None, sub_folder: str, extensions: List[str]) → List[str]

Internal helper to list files with specified extensions from a sub-folder within the global content directory.