From ed8c4dee79f5964c3f09e6b3d3f353ac519b1b08 Mon Sep 17 00:00:00 2001 From: bigbiff Date: Sun, 17 Oct 2021 20:02:17 -0400 Subject: [PATCH] apex: cleanup apex directory bind mount names Change-Id: Ia120ed12f3ae551044907dfd1fd05444be78d18c --- twrpApex.cpp | 5 ++++- twrpApex.hpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/twrpApex.cpp b/twrpApex.cpp index ca6cff426..22da17a91 100755 --- a/twrpApex.cpp +++ b/twrpApex.cpp @@ -169,7 +169,10 @@ bool twrpApex::loadApexImage(std::string fileToMount, size_t loop_device_number) 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 d03df106e..b3809dd98 100755 --- a/twrpApex.hpp +++ b/twrpApex.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include