summaryrefslogtreecommitdiff
path: root/src/common/file_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/file_util.cpp')
-rw-r--r--src/common/file_util.cpp25
1 files changed, 3 insertions, 22 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 9ada09f8a..578c673b9 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -824,13 +824,12 @@ size_t WriteStringToFile(bool text_file, const std::string &str, const char *fil
824 824
825size_t ReadFileToString(bool text_file, const char *filename, std::string &str) 825size_t ReadFileToString(bool text_file, const char *filename, std::string &str)
826{ 826{
827 FileUtil::IOFile file(filename, text_file ? "r" : "rb"); 827 IOFile file(filename, text_file ? "r" : "rb");
828 auto const f = file.GetHandle();
829 828
830 if (!f) 829 if (!file)
831 return false; 830 return false;
832 831
833 str.resize(static_cast<u32>(GetSize(f))); 832 str.resize(static_cast<u32>(file.GetSize()));
834 return file.ReadArray(&str[0], str.size()); 833 return file.ReadArray(&str[0], str.size());
835} 834}
836 835
@@ -880,10 +879,6 @@ IOFile::IOFile()
880 : m_file(nullptr), m_good(true) 879 : m_file(nullptr), m_good(true)
881{} 880{}
882 881
883IOFile::IOFile(std::FILE* file)
884 : m_file(file), m_good(true)
885{}
886
887IOFile::IOFile(const std::string& filename, const char openmode[]) 882IOFile::IOFile(const std::string& filename, const char openmode[])
888 : m_file(nullptr), m_good(true) 883 : m_file(nullptr), m_good(true)
889{ 884{
@@ -935,20 +930,6 @@ bool IOFile::Close()
935 return m_good; 930 return m_good;
936} 931}
937 932
938std::FILE* IOFile::ReleaseHandle()
939{
940 std::FILE* const ret = m_file;
941 m_file = nullptr;
942 return ret;
943}
944
945void IOFile::SetHandle(std::FILE* file)
946{
947 Close();
948 Clear();
949 m_file = file;
950}
951
952u64 IOFile::GetSize() 933u64 IOFile::GetSize()
953{ 934{
954 if (IsOpen()) 935 if (IsOpen())