mirror of
https://anongit.gentoo.org/git/repo/gentoo.git
synced 2025-06-09 06:35:19 +02:00
Closes: https://bugs.gentoo.org/775182 Signed-off-by: Michael Mair-Keimberger <mmk@levelnine.at> Closes: https://github.com/gentoo/gentoo/pull/39846 Signed-off-by: Conrad Kostecki <conikost@gentoo.org>
32 lines
577 B
Diff
32 lines
577 B
Diff
--- a/src/main.cpp
|
|
+++ b/src/main.cpp
|
|
@@ -6,6 +6,7 @@
|
|
|
|
#include <string>
|
|
using namespace std;
|
|
+#include <unistd.h>
|
|
|
|
/* Needed on windows to link main with SDLmain. */
|
|
#include <SDL/SDL.h>
|
|
@@ -20,9 +21,20 @@
|
|
|
|
if(argc < 2) {
|
|
/* Some default. */
|
|
+ chdir("/usr/share/jvgs/");
|
|
fileName = "main.lua";
|
|
} else {
|
|
- fileName = argv[1];
|
|
+ char *pos;
|
|
+ pos = strrchr(argv[1],'/');
|
|
+ if(pos) {
|
|
+ *pos='\0';
|
|
+ pos++;
|
|
+ chdir(argv[1]);
|
|
+ fileName=pos;
|
|
+ }
|
|
+ else {
|
|
+ fileName = argv[1];
|
|
+ }
|
|
}
|
|
|
|
scriptManager->runScript(fileName);
|