apex: cleanup apex directory bind mount names

Change-Id: Ia120ed12f3ae551044907dfd1fd05444be78d18c
diff --git a/twrpApex.cpp b/twrpApex.cpp
index ca6cff4..22da17a 100755
--- a/twrpApex.cpp
+++ b/twrpApex.cpp
@@ -169,7 +169,10 @@
 	close(loop_fd);
 
 	std::string bind_mount(APEX_BASE);
-	bind_mount = bind_mount + basename(fileToMount.c_str());
+	std::string apex_cleaned_mount = fileToMount;
+	apex_cleaned_mount = std::regex_replace(apex_cleaned_mount, std::regex("\\.apex"), "");
+
+	bind_mount = bind_mount + basename(apex_cleaned_mount.c_str());
 
 	int ret = mkdir(bind_mount.c_str(), 0666);
 	if (ret != 0) {
diff --git a/twrpApex.hpp b/twrpApex.hpp
index d03df10..b3809dd 100755
--- a/twrpApex.hpp
+++ b/twrpApex.hpp
@@ -5,6 +5,7 @@
 #include <string>
 #include <vector>
 #include <filesystem>
+#include <regex>
 #include <sstream>
 
 #include <sys/types.h>