diff options
| author | void_17 <61356189+void2012@users.noreply.github.com> | 2026-03-02 00:50:22 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-02 00:50:22 +0700 |
| commit | 33e1b5ceb9970e08cb6b2b987afdff4bd42331ac (patch) | |
| tree | 243817a684579f5f78739910602ab68360ded1ee /Minecraft.Client | |
| parent | 44b68333a31727f2869470acb8df3dab2c653f68 (diff) | |
| parent | e23945a020f6483202e21df360f615b1ea55b119 (diff) | |
Merge pull request #25 from NEVARLeVrai/main
Fix for exe not running, not founding the project directory
Diffstat (limited to 'Minecraft.Client')
| -rw-r--r-- | Minecraft.Client/Windows64/Windows64_Minecraft.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 931e7f17..42fb2d44 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -716,6 +716,26 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); + + WCHAR exePath[MAX_PATH] = { 0 }; + GetModuleFileNameW(NULL, exePath, MAX_PATH); + WCHAR* lastSlash = wcsrchr(exePath, L'\\'); + if (lastSlash) { + *lastSlash = L'\0'; + + WCHAR devCheckPath[MAX_PATH] = { 0 }; + swprintf_s(devCheckPath, MAX_PATH, L"%s\\..\\..\\Minecraft.Client\\Minecraft.Client.vcxproj", exePath); + + if (GetFileAttributesW(devCheckPath) != INVALID_FILE_ATTRIBUTES) { + WCHAR projectPath[MAX_PATH] = { 0 }; + swprintf_s(projectPath, MAX_PATH, L"%s\\..\\..\\Minecraft.Client", exePath); + SetCurrentDirectoryW(projectPath); + } + else { + SetCurrentDirectoryW(exePath); + } + } + // Declare DPI awareness so GetSystemMetrics returns physical pixels SetProcessDPIAware(); g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN); |
