From cfd88e9ed2f15e9adcaa939fa64357df0e00c339 Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Sat, 28 Aug 2021 13:58:00 +0200 Subject: [PATCH] default_image_folder cannot be an empty string, removed obsolete check --- src/raspberrypi/rascsi.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/raspberrypi/rascsi.cpp b/src/raspberrypi/rascsi.cpp index b6e39fa6..b1af991d 100644 --- a/src/raspberrypi/rascsi.cpp +++ b/src/raspberrypi/rascsi.cpp @@ -747,8 +747,8 @@ bool ProcessCmd(int fd, const PbDeviceDefinition& pbDevice, const PbOperation op } catch(const io_exception& e) { // If the file does not exist search for it in the default image folder - string file = default_image_folder + "/" + filename; - filepath.SetPath(file.c_str()); + string default_file = default_image_folder + "/" + filename; + filepath.SetPath(default_file.c_str()); try { fileSupport->Open(filepath); } @@ -887,19 +887,14 @@ bool ProcessCmd(int fd, const PbDeviceDefinition& pbDevice, const PbOperation op fileSupport->Open(filepath); } catch(const io_exception& e) { - if (!default_image_folder.empty()) { - // If the file does not exist search for it in the default image folder - string default_file = default_image_folder + "/" + filename; - filepath.SetPath(default_file.c_str()); - try { - fileSupport->Open(filepath); - } - catch(const io_exception&) { - return ReturnStatus(fd, false, "Tried to open an invalid file '" + filename + "': " + e.getmsg()); - } + // If the file does not exist search for it in the default image folder + string default_file = default_image_folder + "/" + filename; + filepath.SetPath(default_file.c_str()); + try { + fileSupport->Open(filepath); } - else { - return ReturnStatus(fd, false, "No default image folder"); + catch(const io_exception&) { + return ReturnStatus(fd, false, "Tried to open an invalid file '" + filename + "': " + e.getmsg()); } } }