From 17ca6402d34caedae3c1a6110a87820dd37b7883 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 29 Jan 2022 04:25:55 -0500 Subject: [PATCH] add instrument read error messages --- src/engine/engine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 48fea3af3..8d9923862 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -4299,30 +4299,36 @@ bool DivEngine::addInstrumentFromFile(const char *path) { warnings=""; FILE* f=ps_fopen(path,"rb"); if (f==NULL) { + lastError=strerror(errno); return false; } unsigned char* buf; ssize_t len; if (fseek(f,0,SEEK_END)!=0) { + lastError=strerror(errno); fclose(f); return false; } len=ftell(f); if (len<0) { + lastError=strerror(errno); fclose(f); return false; } if (len==0) { + lastError=strerror(errno); fclose(f); return false; } if (fseek(f,0,SEEK_SET)!=0) { + lastError=strerror(errno); fclose(f); return false; } buf=new unsigned char[len]; if (fread(buf,1,len,f)!=(size_t)len) { logW("did not read entire instrument file buffer!\n"); + lastError="did not read entire instrument file!"; delete[] buf; return false; }