
kolossal
Hands on Rust: Need help with error - thread 'main' panicked at 'Failed to load texture
Hi, I need some help, I’m new to rust and was learning through your book. but I got stuck at the last stage of distribution. Whenever I try to run the release binary by double-clicking it gives me the following error. I even ran the source code from Github itself and have also copied the resources folder.
thread 'main' panicked at 'Failed to load texture: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })', /Users/harsh/.cargo/registry/src/github.com-1ecc6299db9ec823/bracket-terminal-0.8.2/src/hal/gl_common/font.rs:41:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Most Liked

herbert
Sorry about formatting; replying one handed from my phone with a baby in the other! You need to include your resources directory in the same folder as the executable. So:
My_game_exec
resources/
resources/fontfiles (the png files)
Hope that helps!

kolossal
No problem at all. Thank you for taking the time and replying Sir.
I have done exactly as the book said and have kept the resources directory in the same folder with the executable including all the resource files too.
I used the “cargo build --release” command to create the binary and then copied the executable from the target/release. I’ve also tried to use the debug build. It gives me the same result. I used the code from Github too but I get the same results.
Side Note: When I embed all the resources like embedded_resource!(TERMINAL_FONT, "../resources/terminal8x8.png");
, the program works.
Popular Prag Prog topics










Other popular topics










Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /ash
- /centos
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /sublime-text
- /textmate
- /react-native
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /django
- /spring
- /diversity
- /lua
- /nodejs
- /julia
- /slackware
- /c
- /neovim