avoid exceptions
This commit is contained in:
@ -198,7 +198,8 @@ ReturnValue_t SdCardManager::setSdCardState(sd::SdCard sdCard, bool on) {
|
||||
ReturnValue_t SdCardManager::getSdCardsStatus(SdStatePair& active) {
|
||||
using namespace std;
|
||||
MutexGuard mg(sdLock, LOCK_TYPE, SD_LOCK_TIMEOUT, LOCK_CTX);
|
||||
if (not filesystem::exists(SD_STATE_FILE)) {
|
||||
std::error_code e;
|
||||
if (not filesystem::exists(SD_STATE_FILE, e)) {
|
||||
return STATUS_FILE_NEXISTS;
|
||||
}
|
||||
|
||||
@ -239,7 +240,8 @@ ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
|
||||
mountDev = SD_1_DEV_NAME;
|
||||
mountPoint = config::SD_1_MOUNT_POINT;
|
||||
}
|
||||
if (not filesystem::exists(mountDev)) {
|
||||
std::error_code e;
|
||||
if (not filesystem::exists(mountDev, e)) {
|
||||
sif::warning << "SdCardManager::mountSdCard: Device file does not exists. Make sure to"
|
||||
" turn on the SD card"
|
||||
<< std::endl;
|
||||
@ -274,7 +276,8 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
|
||||
} else if (sdCard == sd::SdCard::SLOT_1) {
|
||||
mountPoint = config::SD_1_MOUNT_POINT;
|
||||
}
|
||||
if (not filesystem::exists(mountPoint)) {
|
||||
std::error_code e;
|
||||
if (not filesystem::exists(mountPoint, e)) {
|
||||
sif::error << "SdCardManager::unmountSdCard: Default mount point " << mountPoint
|
||||
<< "does not exist" << std::endl;
|
||||
return UNMOUNT_ERROR;
|
||||
|
Reference in New Issue
Block a user