Use asset root

--HG--
branch : feature-material-editor
hg/feature/material-editor
kaetemi 9 years ago
parent 95ea710466
commit 019ca734c7

@ -53,7 +53,7 @@ public:
/// Undo init
static void release();
static std::string databaseRoot();
static std::string assetRoot();
private:
static void cleanup();

@ -233,6 +233,12 @@ void CProjectConfig::release()
cleanup();
}
std::string CProjectConfig::assetRoot()
{
return CFile::getPath(s_AssetConfigPath);
}
/*
std::string CProjectConfig::databaseRoot()
{
for (uint i = 0; i < s_ConfigFiles.size(); ++i)
@ -246,6 +252,7 @@ std::string CProjectConfig::databaseRoot()
return "";
}
*/
} /* namespace NLPIPELINE */

@ -111,14 +111,14 @@ sint main(int argc, char **argv)
CFile::createDirectoryTree(appData + "screenshots/");
CFile::setRWAccess(localAppData + "andbasr.ttf");
QFile::remove(QString::fromStdString(localAppData + "andbasr.ttf"));
QFile(":/data/andbasr.ttf").copy(QString::fromStdString(localAppData + "andbasr.ttf"));
QFile::remove(QString::fromUtf8((localAppData + "andbasr.ttf").c_str()));
QFile(":/data/andbasr.ttf").copy(QString::fromUtf8((localAppData + "andbasr.ttf").c_str()));
CFile::setRWAccess(appData + "mesh_editor_default.cfg");
QFile::remove(QString::fromStdString(appData + "mesh_editor_default.cfg"));
QFile(":/data/mesh_editor_default.cfg").copy(QString::fromStdString(appData + "mesh_editor_default.cfg"));
if (!QFileInfo(QString::fromStdString(appData + "mesh_editor.cfg")).exists())
QFile::remove(QString::fromUtf8((appData + "mesh_editor_default.cfg").c_str()));
QFile(":/data/mesh_editor_default.cfg").copy(QString::fromUtf8((appData + "mesh_editor_default.cfg").c_str()));
if (!QFileInfo(QString::fromUtf8((appData + "mesh_editor.cfg").c_str())).exists())
{
QFile(":/data/mesh_editor.cfg").copy(QString::fromStdString(appData + "mesh_editor.cfg"));
QFile(":/data/mesh_editor.cfg").copy(QString::fromUtf8((appData + "mesh_editor.cfg").c_str()));
CFile::setRWAccess(appData + "mesh_editor.cfg");
}

@ -124,9 +124,8 @@ void CMainWindow::initProjectConfig(const std::string &asset)
NLPIPELINE::CProjectConfig::DatabaseTextureSearchPaths,
true);
std::string databaseRoot = NLPIPELINE::CProjectConfig::databaseRoot();
if (!databaseRoot.empty()) m_AssetTreeView->setRootIndex(m_AssetTreeModel->index(QString::fromStdString(databaseRoot)));
else m_AssetTreeView->setRootIndex(m_AssetTreeModel->index(""));
std::string databaseRoot = NLPIPELINE::CProjectConfig::assetRoot();
m_AssetTreeView->setRootIndex(m_AssetTreeModel->index(QString::fromUtf8(databaseRoot.c_str())));
}
void CMainWindow::closeEvent(QCloseEvent *e)

Loading…
Cancel
Save