From f452bf89f1b85b37a0aa130bcf23e59238a94081 Mon Sep 17 00:00:00 2001 From: "jean.chalard" Date: Thu, 1 Jan 2009 23:25:47 +0000 Subject: [PATCH] J : * Make it so that the binary can be run from anywhere. --- JGE/src/Xmain.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/JGE/src/Xmain.cpp b/JGE/src/Xmain.cpp index e3587f2f5..96d4aab4a 100644 --- a/JGE/src/Xmain.cpp +++ b/JGE/src/Xmain.cpp @@ -1,3 +1,4 @@ +#include #include // Header File For The OpenGL32 Library #include // Header File For The GLu32 Library #include @@ -393,6 +394,12 @@ void fullscreen() int main(int argc, char* argv[]) { + char* path = argv[0]; + while (*path) ++path; + while ((*path != '/') && (path > argv[0])) --path; + if ('/' == *path) *path = 0; + if (strlen(argv[0]) != 0) chdir(argv[0]); + g_launcher = new JGameLauncher(); u32 flags = g_launcher->GetInitFlags();