diff options
| author | HampusM <hampus@hampusmat.com> | 2026-07-06 22:48:31 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-07-06 22:48:31 +0200 |
| commit | b4e8793d7ccea40da275affae00446775fa752ee (patch) | |
| tree | 5d905e539c37221af1d36fb9ce5015eee13e0dd1 | |
| parent | dadf2f2e6036dd8045ecb07f61e0d089469779f9 (diff) | |
feat: enable ANSI support on Windows
| -rw-r--r-- | Cargo.lock | 1 | ||||
| -rw-r--r-- | Cargo.toml | 3 | ||||
| -rw-r--r-- | src/main.rs | 8 |
3 files changed, 10 insertions, 2 deletions
@@ -792,6 +792,7 @@ name = "game-newest" version = "0.1.0" dependencies = [ "engine", + "nu-ansi-term", "tracing", "tracing-subscriber", ] @@ -22,3 +22,6 @@ tracing = { version = "0.1.39", features = ["max_level_trace", "release_max_leve [dependencies.tracing-subscriber] version = "0.3.17" features = ["env-filter", "chrono", "tracing-log"] + +[target.'cfg(windows)'.dependencies] +nu-ansi-term = "0.50.3" diff --git a/src/main.rs b/src/main.rs index 13ec797..667ac62 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,4 @@ #![cfg_attr(all(windows, not(debug_assertions)), windows_subsystem = "windows")] -use std::error::Error; use std::io::Cursor; use std::path::Path; @@ -52,8 +51,13 @@ const YELLOW: Color<f32> = Color { const RESOURCE_DIR: &str = "res"; -fn main() -> Result<(), Box<dyn Error>> +fn main() -> Result<(), EngineError> { + #[cfg(windows)] + nu_ansi_term::enable_ansi_support() + .map_err(EngineError::from_system_defined_win32_error) + .with_context(|| "Failed to enable ANSI support")?; + tracing_subscriber::registry() .with( tracing_subscriber::fmt::layer() |
