Add ResourceLoaderAppDirLinux
This commit is contained in:
@@ -28,10 +28,14 @@ namespace OpenVulkano
|
||||
#endif
|
||||
}
|
||||
|
||||
Array<char> Utils::ReadFile(const std::string& filePath)
|
||||
Array<char> Utils::ReadFile(const std::string& filePath, bool emptyOnMissing)
|
||||
{
|
||||
std::ifstream file(filePath, std::ios::ate | std::ios::binary);
|
||||
if (!file.is_open()) throw std::runtime_error("Failed to open file '" + filePath + "'!");
|
||||
if (!file.is_open())
|
||||
{
|
||||
if (emptyOnMissing) return { 0 };
|
||||
throw std::runtime_error("Failed to open file '" + filePath + "'!");
|
||||
}
|
||||
const size_t fileSize = static_cast<size_t>(file.tellg());
|
||||
Array<char> data(fileSize);
|
||||
file.seekg(0);
|
||||
|
||||
@@ -134,6 +134,6 @@ namespace OpenVulkano
|
||||
else return {str.substr(0, pos), str.substr(pos + 1)};
|
||||
}
|
||||
|
||||
static Array<char> ReadFile(const std::string& filePath);
|
||||
static Array<char> ReadFile(const std::string& filePath, bool emptyOnMissing = false);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user