mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
Now ensures that the directory to the config file exists before Ogre tries to access it
This commit is contained in:
parent
5dbbc5bb7b
commit
0e3859385d
2 changed files with 24 additions and 0 deletions
|
@ -164,6 +164,22 @@ void GraphicsPage::setupOgre()
|
|||
QString ogreCfg = QString::fromStdString(mCfg.getOgreConfigPath().string());
|
||||
file.setFileName(ogreCfg);
|
||||
|
||||
//we need to check that the path to the configuration file exists before we
|
||||
//try and create an instance of Ogre::Root otherwise Ogre raises an exception
|
||||
QDir configDir = QFileInfo(file).dir();
|
||||
if ( !configDir.exists() && !configDir.mkpath(configDir.path()) )
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("Error creating config file");
|
||||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setText(QString(tr("<br><b>Failed to create the configuration file</b><br><br> \
|
||||
Make sure you have write access to<br>%1<br><br>")).arg(configDir.path()));
|
||||
msgBox.exec();
|
||||
|
||||
QApplication::exit(1);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
mOgre = new Ogre::Root(pluginCfg.toStdString(), file.fileName().toStdString(), "./launcherOgre.log");
|
||||
|
|
|
@ -291,6 +291,14 @@ void OMW::Engine::go()
|
|||
|
||||
mOgre = new OEngine::Render::OgreRenderer;
|
||||
|
||||
//we need to ensure the path to the configuration exists before creating an
|
||||
//instance of ogre root so that Ogre doesn't raise an exception when trying to
|
||||
//access it
|
||||
const boost::filesystem::path configPath = mCfgMgr.getOgreConfigPath().parent_path();
|
||||
if ( !boost::filesystem::exists(configPath) )
|
||||
{
|
||||
boost::filesystem::create_directories(configPath);
|
||||
}
|
||||
mOgre->configure(!boost::filesystem::is_regular_file(mCfgMgr.getOgreConfigPath()),
|
||||
mCfgMgr.getOgreConfigPath().string(),
|
||||
mCfgMgr.getLogPath().string() + std::string("/"),
|
||||
|
|
Loading…
Reference in a new issue