1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

Show error message if vcmi unable to access data directory instead of

silent crash
This commit is contained in:
Ivan Savenko
2024-06-19 18:25:54 +00:00
parent 0e4be8c776
commit 2b7131cfea
3 changed files with 20 additions and 3 deletions

View File

@ -10,6 +10,8 @@
#include "StdInc.h"
#include "CFileInputStream.h"
#include "../ExceptionsCommon.h"
VCMI_LIB_NAMESPACE_BEGIN
CFileInputStream::CFileInputStream(const boost::filesystem::path & file, si64 start, si64 size)
@ -18,7 +20,7 @@ CFileInputStream::CFileInputStream(const boost::filesystem::path & file, si64 st
fileStream{file.c_str(), std::ios::in | std::ios::binary}
{
if (fileStream.fail())
throw std::runtime_error("File " + file.string() + " isn't available.");
throw DataLoadingException("Failed to open file '" + file.string() + "'. Reason: " + strerror(errno) );
if (dataSize == 0)
{