mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 09:00:44 +00:00
Add error message in case reading from file fails while embedding
This commit is contained in:
@@ -1067,11 +1067,20 @@ struct EmbeddedSectionCommand : public Command
|
||||
bytebuf blob;
|
||||
|
||||
fseek(f, 0, SEEK_END);
|
||||
size_t len = (size_t)ftell(f);
|
||||
int len = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
|
||||
blob.resize(len);
|
||||
fread(blob.data(), 1, len, f);
|
||||
if(len < 0)
|
||||
{
|
||||
len = 0;
|
||||
std::cerr << "I/O error reading from '" << file << "'" << std::endl;
|
||||
}
|
||||
|
||||
blob.resize((size_t)len);
|
||||
size_t read = fread(blob.data(), 1, (size_t)len, f);
|
||||
|
||||
if(read != (size_t)len)
|
||||
std::cerr << "I/O error reading from '" << file << "'" << std::endl;
|
||||
|
||||
fclose(f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user