utils: Remove text file Get/Set methods from Platform

No longer needed, and using Qt isn't good anyway
This commit is contained in:
tt2468 2024-04-22 18:23:39 -07:00
parent bdf812dc09
commit 42e7eb6c34
2 changed files with 0 additions and 27 deletions

View File

@ -21,7 +21,6 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include <QCommandLineParser>
#include <QNetworkInterface>
#include <QHostAddress>
#include <QFile>
#include <obs-frontend-api.h>
#include "Platform.h"
@ -126,27 +125,3 @@ void Utils::Platform::SendTrayNotification(QSystemTrayIcon::MessageIcon icon, QS
},
(void *)notification, false);
}
bool Utils::Platform::GetTextFileContent(std::string fileName, std::string &content)
{
QFile f(QString::fromStdString(fileName));
if (!f.open(QIODevice::ReadOnly | QIODevice::Text))
return false;
content = f.readAll().toStdString();
return true;
}
bool Utils::Platform::SetTextFileContent(std::string fileName, std::string content, bool createNew)
{
if (!createNew && !QFile::exists(QString::fromStdString(fileName)))
return false;
QFile f(QString::fromStdString(fileName));
if (!f.open(QIODevice::WriteOnly | QIODevice::Text))
return false;
QTextStream out(&f);
out << content.c_str();
return true;
}

View File

@ -29,7 +29,5 @@ namespace Utils {
QString GetCommandLineArgument(QString arg);
bool GetCommandLineFlagSet(QString arg);
void SendTrayNotification(QSystemTrayIcon::MessageIcon icon, QString title, QString body);
bool GetTextFileContent(std::string fileName, std::string &content);
bool SetTextFileContent(std::string filePath, std::string content, bool createNew = true);
}
}