From 0f500fab826a57f8aae8a3e2062a90ee9e80a199 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 8 Jun 2014 13:57:15 +0300 Subject: Add ShaderManager and Shader class. --- src/utils/files.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/utils/files.cpp') diff --git a/src/utils/files.cpp b/src/utils/files.cpp index d3a04d69f..e435249da 100644 --- a/src/utils/files.cpp +++ b/src/utils/files.cpp @@ -270,6 +270,22 @@ std::string Files::getPath(const std::string &file) return path; } +std::string Files::loadTextFileString(const std::string &fileName) +{ + int contentsLength; + char *fileContents = static_cast( + PhysFs::loadFile(fileName, contentsLength)); + + if (!fileContents) + { + logger->log("Couldn't load text file: %s", fileName.c_str()); + return std::string(); + } + const std::string str = std::string(fileContents, contentsLength); + free(fileContents); + return str; +} + bool Files::loadTextFile(const std::string &fileName, StringVect &lines) { -- cgit v1.2.3-70-g09d2