From 42e7eb6c344ae62dce9d60baa906002015b85286 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Mon, 22 Apr 2024 18:23:39 -0700 Subject: [PATCH] utils: Remove text file Get/Set methods from Platform No longer needed, and using Qt isn't good anyway --- src/utils/Platform.cpp | 25 ------------------------- src/utils/Platform.h | 2 -- 2 files changed, 27 deletions(-) diff --git a/src/utils/Platform.cpp b/src/utils/Platform.cpp index d8920c23..e8045dd8 100644 --- a/src/utils/Platform.cpp +++ b/src/utils/Platform.cpp @@ -21,7 +21,6 @@ with this program. If not, see #include #include #include -#include #include #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; -} diff --git a/src/utils/Platform.h b/src/utils/Platform.h index aee2213d..b013c51a 100644 --- a/src/utils/Platform.h +++ b/src/utils/Platform.h @@ -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); } }