Improve flash image handling of mounting
Flashing an image does not always require storage to be mounted.
Change-Id: I9d2a69cee9053f7829e51486d727e2e0b522c5da
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index 4cd3e7d..eeeafb2 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -2211,8 +2211,15 @@
gui_msg("image_flash_start=[IMAGE FLASH STARTED]");
gui_msg(Msg("img_to_flash=Image to flash: '{1}'")(Filename));
- if (!Mount_Current_Storage(true))
- return false;
+ if (!TWFunc::Path_Exists(Filename)) {
+ if (!Mount_By_Path(Filename, true)) {
+ return false;
+ }
+ if (!TWFunc::Path_Exists(Filename)) {
+ gui_msg(Msg(msg::kError, "unable_to_locate=Unable to locate {1}.")(Filename));
+ return false;
+ }
+ }
gui_msg("calc_restore=Calculating restore details...");
DataManager::GetValue("tw_flash_partition", Flash_List);