diff --git a/.gitignore b/.gitignore
index 1f7f3cb..9948f46 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 build
 .cache
 .vs
-vs*
\ No newline at end of file
+vs*
+*.exe
\ No newline at end of file
diff --git a/main.cpp b/main.cpp
index 3608195..e1af336 100644
--- a/main.cpp
+++ b/main.cpp
@@ -381,13 +381,13 @@ int main(int argc, char** argv)
 
 #if _DEBUG
     std::cout << "Debug Mode." << std::endl;
-    fs::path exe_path(argv[0]);
-    gParam.exe_dir = fs::current_path().parent_path().string();
+    fs::path exe_path(CUtil::get_exe_path());
+    gParam.exe_dir = exe_path.parent_path().parent_path().string();
     std::cout << std::format("current_path is: {}", gParam.exe_dir) << "\n";
 #else
     std::cout << "Release Mode." << std::endl;
-    fs::path exe_path(argv[0]);
-    gParam.exe_dir = fs::current_path().string();
+    fs::path exe_path(CUtil::get_exe_path());
+    gParam.exe_dir = exe_path.parent_path().string();
     std::cout << std::format("current_path is: {}", gParam.exe_dir) << "\n";
 #endif
 
diff --git a/src/pub.cpp b/src/pub.cpp
index 89faf1f..16994d5 100644
--- a/src/pub.cpp
+++ b/src/pub.cpp
@@ -1,6 +1,15 @@
 #include "pub.h"
 #include <filesystem>
 
+#ifdef _WIN32
+#include <windows.h>
+#elif defined(__clang__) && defined(__APPLE__)
+#include <unistd.h>
+#include <mach-o/dyld.h>
+#else
+#include <unistd.h>
+#endif
+
 namespace fs = std::filesystem;
 
 CUtil::CUtil() = default;
@@ -81,4 +90,33 @@ std::string CUtil::get_keybindings_file()
 #endif
     path = ret.append("keybindings.json").string();
     return path;
-}
\ No newline at end of file
+}
+
+std::string CUtil::get_exe_path()
+{
+    std::string path;
+#ifdef _WIN32
+    char buffer[MAX_PATH];
+    DWORD length = GetModuleFileName(NULL, buffer, MAX_PATH);
+    if (length == 0) {
+        return "";
+    }
+    return std::string(buffer, length);
+#elif defined(__clang__) && defined(__APPLE__)
+    uint32_t size = 0;
+    _NSGetExecutablePath(NULL, &size);  // 获取路径缓冲区的大小
+    std::vector<char> buffer(size);     // 创建缓冲区
+    if (_NSGetExecutablePath(buffer.data(), &size) != 0) {
+        return "";
+    }
+    return std::string(buffer.data());
+#else
+    char buffer[PATH_MAX];
+    ssize_t len = readlink("/proc/self/exe", buffer, sizeof(buffer) - 1);
+    if (len == -1) {
+        return "";
+    }
+    buffer[len] = '\0';  // 确保字符串以null终止
+    return std::string(buffer);
+#endif
+}
diff --git a/src/pub.h b/src/pub.h
index 03b77eb..b6c131e 100644
--- a/src/pub.h
+++ b/src/pub.h
@@ -16,6 +16,7 @@ public:
     static std::string replace(const std::string& content, const std::string& from, const std::string& to);
     static std::string get_home();
     static std::string get_keybindings_file();
+    static std::string get_exe_path();
 };