Add check for image dir
If the image dir exists already, delete it.
Change-Id: I36242ee50d8af828784efa54a46f92ca3e3c971f
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/image_manager.cpp b/image_manager.cpp
index bc6c96f..8599196 100644
--- a/image_manager.cpp
+++ b/image_manager.cpp
@@ -155,6 +155,10 @@
fs::path imageDirPath = std::string{IMG_UPLOAD_DIR};
imageDirPath /= id;
+ if (fs::exists(imageDirPath))
+ {
+ fs::remove_all(imageDirPath);
+ }
if (mkdir(imageDirPath.c_str(), S_IRWXU) != 0)
{
log<level::ERR>("Error occured during mkdir",