Hands-on Rust: Failed to Load Texture error (page 121)

Hi,
I completed chapter 6 but am getting the following error when running:

thread 'main' panicked at 'Failed to load texture: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })', (my file path) /bracket-terminal-0.8.5/src/hal/gl_common/font.rs:41:18

I made sure I have the font (properly named) in the resources directory, and I compared the code that loads the font with the online version:

fn main() -> BError {
    let context = BTermBuilder::new()
        .with_title("Dungeon Crawler")
        .with_fps_cap(30.0)
        .with_dimensions(DISPLAY_WIDTH, DISPLAY_HEIGHT)
        .with_tile_dimensions(32, 32)
        .with_resource_path("resources/")
        .with_font("dungeonfont.png", 32, 32)
        .with_simple_console(DISPLAY_WIDTH, DISPLAY_HEIGHT, "dungeonfont.png")
        .with_simple_console_no_bg(DISPLAY_WIDTH, DISPLAY_HEIGHT, "dungeonfont.png")
        .build()?;

    main_loop(context, State::new())
}

Thank you for any help!

User error. My resources folder had been nested in the source directory when it should have been one level up. :man_facepalming:

1 Like

Glad you got it figured out! I was about to suggest that you check your folder layout.

1 Like

Thank you @herbert and for the great book.