diff --git a/manager.sh b/manager.sh index b34fb42..f2b09ea 100644 --- a/manager.sh +++ b/manager.sh @@ -39,9 +39,9 @@ select_variant() if getprop ro.product.cpu.abi | grep "arm64-v8a" &>/dev/null; then ARCH="arm64-v8a"; else ARCH="armeabi-v7a" fi - grep "static" <<< $1 &>/dev/null && VARIANT="static-" + grep "static" <<< $1 &>/dev/null && VARIANT="static-" - LINK="https://github.com/ShawkTeam/pmt-renovated/releases/download/${RELEASE}/pmt-${VARIANT}${ARCH}.zip" + LINK="https://github.com/ShawkTeam/pmt-renovated/releases/download/${RELEASE}/pmt-${VARIANT}${ARCH}.zip" } download() @@ -105,15 +105,15 @@ case $1 in is_installed checks select_variant $(grep "static" <<< $2 &>/dev/null && echo static) - download - setup + download + setup ;; "uninstall") uninstall && echo "Uninstalled successfully." ;; "reinstall") - uninstall - checks + uninstall + checks select_variant $(grep "static" <<< $2 &>/dev/null && echo static) download setup diff --git a/src/PartitionManager.cpp b/src/PartitionManager.cpp index 1faf9de..b04de6e 100644 --- a/src/PartitionManager.cpp +++ b/src/PartitionManager.cpp @@ -16,12 +16,13 @@ #include "functions/functions.hpp" #include +#include #include #include #include +#include #include #include -#include namespace PartitionManager { @@ -30,10 +31,16 @@ void init() { Helper::LoggingProperties::setLogFile("/sdcard/Documents/last_pmt_logs.log"); } +static void sigHandler(const int sig) { + // Even if only SIGINT is to be captured for now, this is still a more appropriate code + if (sig == SIGINT) println("\n%sInterrupted.%s", YELLOW, STYLE_RESET); + exit(sig); +} + auto Variables = std::make_unique(); basic_variables::basic_variables() - : logFile("/sdcard/Documents/last_pmt_logs.log"), onLogical(false), + : logFile(Helper::LoggingProperties::FILE), onLogical(false), quietProcess(false), verboseMode(false), viewVersion(false), forceProcess(false) { try { @@ -45,6 +52,15 @@ basic_variables::basic_variables() int Main(int argc, char **argv) { try { // try-catch start + if (argc < 2) { + println( + "Usage: %s [OPTIONS] [SUBCOMMAND]\nUse --help for more information.", + argv[0]); + return EXIT_FAILURE; + } + + signal(SIGINT, sigHandler); + CLI::App AppMain{"Partition Manager Tool"}; FunctionManager FuncManager; @@ -77,13 +93,6 @@ int Main(int argc, char **argv) { AppMain.add_flag("-v,--version", Variables->viewVersion, "Print version and exit"); - if (argc < 2) { - println( - "Usage: %s [OPTIONS] [SUBCOMMAND]\nUse --help for more information.", - argv[0]); - return EXIT_FAILURE; - } - FuncManager.registerFunction(std::make_unique(), AppMain); FuncManager.registerFunction(std::make_unique(), AppMain); FuncManager.registerFunction(std::make_unique(), AppMain); diff --git a/srclib/libpartition_map/include/libpartition_map/lib.hpp b/srclib/libpartition_map/include/libpartition_map/lib.hpp index a97364e..5dd3d4e 100644 --- a/srclib/libpartition_map/include/libpartition_map/lib.hpp +++ b/srclib/libpartition_map/include/libpartition_map/lib.hpp @@ -42,7 +42,7 @@ struct _entry { * The main type of the library. The Builder class is designed * to be easily manipulated and modified only on this class. */ -class basic_partition_map final { +class basic_partition_map { private: void _resize_map();