From a3df7822451c3d4c7dc83d4d5caad7a6d59416a4 Mon Sep 17 00:00:00 2001 From: neru Date: Thu, 9 Apr 2026 06:40:34 -0300 Subject: [PATCH] feat: add getExePath --- src/unlocker/utils.cpp | 14 ++++++++++++++ src/unlocker/utils.h | 8 ++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/unlocker/utils.cpp create mode 100644 src/unlocker/utils.h diff --git a/src/unlocker/utils.cpp b/src/unlocker/utils.cpp new file mode 100644 index 0000000..71c53c6 --- /dev/null +++ b/src/unlocker/utils.cpp @@ -0,0 +1,14 @@ +#include "utils.h" + +#include +#include + +std::string utils::getExePath() +{ + char buffer[MAX_PATH]; + GetModuleFileNameA(NULL, buffer, MAX_PATH); + std::string path(buffer); + size_t pos = path.find_last_of("\\/"); + if (pos != std::string::npos) return path.substr(0, pos + 1); + return ""; +} diff --git a/src/unlocker/utils.h b/src/unlocker/utils.h new file mode 100644 index 0000000..e71e638 --- /dev/null +++ b/src/unlocker/utils.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +namespace utils +{ + std::string getExePath(); +} \ No newline at end of file