mirror of
https://github.com/wiiu-env/wiiload_plugin.git
synced 2024-11-25 20:16:52 +01:00
Abort file loading if saving the file to the sd card fails
This commit is contained in:
parent
7d7b04f3ea
commit
2d87a6e982
@ -107,7 +107,7 @@ int32_t CFile::read(uint8_t *ptr, size_t size) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CFile::write(const uint8_t *ptr, size_t size) {
|
int64_t CFile::write(const uint8_t *ptr, size_t size) {
|
||||||
if (iFd >= 0) {
|
if (iFd >= 0) {
|
||||||
size_t done = 0;
|
size_t done = 0;
|
||||||
while (done < size) {
|
while (done < size) {
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
|
|
||||||
int32_t read(uint8_t *ptr, size_t size);
|
int32_t read(uint8_t *ptr, size_t size);
|
||||||
|
|
||||||
int32_t write(const uint8_t *ptr, size_t size);
|
int64_t write(const uint8_t *ptr, size_t size);
|
||||||
|
|
||||||
int32_t fwrite(const char *format, ...);
|
int32_t fwrite(const char *format, ...);
|
||||||
|
|
||||||
|
@ -132,10 +132,14 @@ int32_t FSUtils::CreateSubfolder(const char *fullpath) {
|
|||||||
BOOL FSUtils::saveBufferToFile(const char *path, void *buffer, uint32_t size) {
|
BOOL FSUtils::saveBufferToFile(const char *path, void *buffer, uint32_t size) {
|
||||||
CFile file(path, CFile::WriteOnly);
|
CFile file(path, CFile::WriteOnly);
|
||||||
if (!file.isOpen()) {
|
if (!file.isOpen()) {
|
||||||
DEBUG_FUNCTION_LINE("Failed to open %s\n", path);
|
DEBUG_FUNCTION_LINE_ERR("Failed to open %s\n", path);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (file.write((const uint8_t *) buffer, size) != size) {
|
||||||
|
DEBUG_FUNCTION_LINE_ERR("Failed to write file %s\n", path);
|
||||||
|
file.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
file.write((const uint8_t *) buffer, size);
|
|
||||||
file.close();
|
file.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user