on the first run we create the file in the current directory. I in some version of win7 the xml is not created.
void mainwindow::checkscoreboardfile()
{
dir
=new QDir(dir
->currentPath
());
QFile file(dir
->filePath
("Score.xml"));
{
{
QXmlStreamWriter* xmlWriter = new QXmlStreamWriter();
xmlWriter->setDevice(&file);
xmlWriter->writeStartElement("Score");
xmlWriter->writeEndElement();
file.close();
}
}
}
void mainwindow::checkscoreboardfile()
{
dir=new QDir(dir->currentPath());
QFile file(dir->filePath("Score.xml"));
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
if (file.open(QIODevice::WriteOnly))
{
QXmlStreamWriter* xmlWriter = new QXmlStreamWriter();
xmlWriter->setDevice(&file);
xmlWriter->writeStartElement("Score");
xmlWriter->writeEndElement();
file.close();
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks