Am I doing something wrong or Irrlicht really does not create the directory as well as the file itself when saving a screenshot?
The way I do it currently is:
Code: Select all
//! createScreenshot
void CGame::createScreenshot()
{
io::IFileSystem* fsys = device->getFileSystem();
io::path fbase = "screenshots/screenshot", fext = ".png";
bool leave = false;
int num = 0;
do
{
io::path fname, fnum;
fnum += num;
fname = fbase;
fname += fnum;
fname += fext;
// check if the screenshot already exists
if (!fsys->existFile(fname))
{
video::IImage* screenshot = driver->createScreenShot();
core::stringw log;
if (driver->writeImageToFile(screenshot, fname))
{
log = fname;
log += " has been created";
}
else
{
log = "Could not create ";
log += fname;
}
screenshot->drop();
iface->setScreenLog(log);
leave = true;
}
if (++num >= 100) leave = true;
}
while (!leave);
}
The question is, shouldn't it create the directory too if it doesn't exists?
As I see it, it's the "writeImageToFile" function where it fails.
Oh, and I'm on Ubuntu linux, if that matters.
Thanks your answers in advance,
easy (formely known as PI)