mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
refs #209, added remove file method to application context and some finetuning of the file methods
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user