From 94e14e1ace16a265b8e58a186c308609c504d288 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 23 Nov 2013 20:26:00 +0100 Subject: Added cFile:ReadWholeFile() to Lua API. --- source/OSSupport/File.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source/OSSupport/File.cpp') diff --git a/source/OSSupport/File.cpp b/source/OSSupport/File.cpp index 86276bd79..274aa52da 100644 --- a/source/OSSupport/File.cpp +++ b/source/OSSupport/File.cpp @@ -420,6 +420,22 @@ AStringVector cFile::GetFolderContents(const AString & a_Folder) +AString cFile::ReadWholeFile(const AString & a_FileName) +{ + cFile f; + if (!f.Open(a_FileName, fmRead)) + { + return ""; + } + AString Contents; + f.ReadRestOfFile(Contents); + return Contents; +} + + + + + int cFile::Printf(const char * a_Fmt, ...) { AString buf; -- cgit v1.2.3