I checked how the examples found files and also played around with <filesystem> and io::IFileSystem and argv[0]. When running my code in an IDE but also being able to test it for release, not both paths are the same.
The only way I could load a file developing it and sending it off to a potential player, I finally had to check both paths and either one will find the file.
Code: Select all
const irr::io::path media_folder_exe = "media/";
const irr::io::path media_folder_vs2022 = "../../bin/media/";
// load texture
// first try in 2022
irr::video::ITexture* img_square = driver->getTexture(media_folder_vs2022 + "water.jpg");
if (img_square == 0) std::cout << "Checked " << media_folder_vs2022.c_str() << ". image not found. Checking bin folder...";
// try with executable
if(img_square == 0) img_square = driver->getTexture(media_folder_exe + "water.jpg");
if(img_square == 0) std::cout << "Checked " << media_folder_exe.c_str() << ". Media. still not found.";
If Irrlicht checks for the media folder - from both exe and main.cpp - ../../media are both true!