Files
Decrypt9/source/debugfs.c
T
d0k3 0d7b5c92aa Replace fs.h io functions with debugfs.h functions
debugfs.c is a wrapper to some fs.c functions, that includes error
checking and output messages.
2015-06-29 23:02:12 +02:00

45 lines
1.0 KiB
C

#include "fs.h"
#include "draw.h"
bool DebugFileOpen(const char* path) {
Debug("Opening %s ...", path);
if (!FileOpen(path)) {
Debug("Could not open %s!", path);
return false;
}
return true;
}
bool DebugFileCreate(const char* path, bool truncate) {
Debug("Creating %s ...", path);
if (!FileCreate(path, truncate)) {
Debug("Could not create %s!", path);
return false;
}
return true;
}
bool DebugFileRead(void* buf, size_t size, size_t foffset) {
size_t bytesRead = FileRead(buf, size, foffset);
if(bytesRead != size) {
Debug("ERROR, file is too small!");
FileClose(); // <- need to keep this in mind!
return false;
}
return true;
}
bool DebugFileWrite(void* buf, size_t size, size_t foffset) {
size_t bytesWritten = FileWrite(buf, size, foffset);
if(bytesWritten != size) {
Debug("ERROR, SD card may be full!");
FileClose(); // <- need to keep this in mind!
return false;
}
return true;
}