refs #209, added remove file method to application context and some finetuning of the file methods

This commit is contained in:
Klaus Basan
2014-04-15 02:58:28 +02:00
parent 284a130669
commit 7e45a92969
5 changed files with 29 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ namespace BlackCore
bool CContextApplication::writeToFile(const QString &fileName, const QString &content)
{
if (this->getRuntime()->isSlotLogForApplicationEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, fileName, content.left(25));
if (fileName.isEmpty()) return false;
QFile file(fileName);
bool success = false;
if ((success = file.open(QIODevice::WriteOnly | QIODevice::Text)))
@@ -78,6 +79,7 @@ namespace BlackCore
if (this->getRuntime()->isSlotLogForApplicationEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, fileName);
QFile file(fileName);
QString content;
if (fileName.isEmpty()) return content;
bool success = false;
if ((success = file.open(QIODevice::ReadOnly | QIODevice::Text)))
{
@@ -88,4 +90,10 @@ namespace BlackCore
return content;
}
bool CContextApplication::removeFile(const QString &fileName)
{
if (fileName.isEmpty()) return false;
return QFile::remove(fileName);
}
} // namespace