mirror of
https://github.com/wiiu-env/homebrew_on_menu_plugin.git
synced 2024-11-25 20:06:53 +01:00
FileReaderWUHB: Fix unmounting when opening the file fails
This commit is contained in:
parent
11e89b04ce
commit
622dff63c6
@ -28,6 +28,9 @@ FileReaderWUHB::FileReaderWUHB(const std::shared_ptr<FileInfos> &info, const std
|
|||||||
WUHBUtilsStatus status;
|
WUHBUtilsStatus status;
|
||||||
if ((status = WUHBUtils_FileOpen(filepath.c_str(), &this->fileHandle)) != WUHB_UTILS_RESULT_SUCCESS) {
|
if ((status = WUHBUtils_FileOpen(filepath.c_str(), &this->fileHandle)) != WUHB_UTILS_RESULT_SUCCESS) {
|
||||||
DEBUG_FUNCTION_LINE("Failed to open file in bundle: %s error: %d", filepath.c_str(), status);
|
DEBUG_FUNCTION_LINE("Failed to open file in bundle: %s error: %d", filepath.c_str(), status);
|
||||||
|
|
||||||
|
UnmountBundle();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->info->fileCount++;
|
this->info->fileCount++;
|
||||||
@ -51,13 +54,7 @@ FileReaderWUHB::~FileReaderWUHB() {
|
|||||||
info->fileCount--;
|
info->fileCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autoUnmount && info->fileCount <= 0) {
|
UnmountBundle();
|
||||||
if (!info->UnmountBundle()) {
|
|
||||||
DEBUG_FUNCTION_LINE_ERR("Failed to unmount");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
DEBUG_FUNCTION_LINE_VERBOSE("Filecount is %d, we don't want to unmount yet", info->fileCount);
|
|
||||||
}
|
|
||||||
OSMemoryBarrier();
|
OSMemoryBarrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,3 +74,12 @@ int64_t FileReaderWUHB::read(uint8_t *buffer, uint32_t size) {
|
|||||||
bool FileReaderWUHB::isReady() {
|
bool FileReaderWUHB::isReady() {
|
||||||
return this->initDone;
|
return this->initDone;
|
||||||
}
|
}
|
||||||
|
void FileReaderWUHB::UnmountBundle() {
|
||||||
|
if (autoUnmount && info->fileCount <= 0) {
|
||||||
|
if (!info->UnmountBundle()) {
|
||||||
|
DEBUG_FUNCTION_LINE_ERR("Failed to unmount");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DEBUG_FUNCTION_LINE_VERBOSE("Filecount is %d, we don't want to unmount yet", info->fileCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -15,4 +15,5 @@ public:
|
|||||||
~FileReaderWUHB() override;
|
~FileReaderWUHB() override;
|
||||||
int64_t read(uint8_t *buffer, uint32_t size) override;
|
int64_t read(uint8_t *buffer, uint32_t size) override;
|
||||||
bool isReady() override;
|
bool isReady() override;
|
||||||
|
void UnmountBundle();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user