Just noting that the result is not the same as with the patch-proposal from pc0de.
For the code:
Code: Select all
#include <irrlicht.h>
using namespace irr;
using namespace io;
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#endif
int main()
{
video::E_DRIVER_TYPE driverType = video::EDT_NULL;
IrrlichtDevice * device = createDevice(driverType, core::dimension2d<u32>(640, 480));
if (device == 0)
return 1; // could not create selected driver.
io::IFileSystem * fs = device->getFileSystem();
path apath = fs->getAbsolutePath ("../nothere.txt"); // file does not exist
printf("../nothere.txt: %s\n", apath.c_str());
apath = fs->getAbsolutePath("../Demo");
printf("../Demo: %s\n", apath.c_str());
apath = fs->getAbsolutePath("../Demo/");
printf("../Demo/: %s\n", apath.c_str());
device->drop();
return 0;
}
I get now that output on Linux:
Code: Select all
../nothere.txt: /home/micha/official_irrlicht/linux/irrlicht/branches/releases/1.7/examples/nothere.txt
../Demo: /home/micha/official_irrlicht/linux/irrlicht/branches/releases/1.7/examples/Demo
../Demo/: /home/micha/official_irrlicht/linux/irrlicht/branches/releases/1.7/examples/Demo
Which means not existing files get a path added. I have no idea if that is better/worse as I would probably prefer a 3rd alternative. Looking at the code I suspect it might return now an empty path on Windows (but I will have to check that when I boot Windows at some time unless someone does it before me). And that would imho make more sense than trying to give it our best guess as is done on Linux, because an empty result allows for error-checking which we are losing otherwise unlike the corresponding system functions.
I would change it once more, but maybe I miss something - so more feedback welcome...