gentoo-ebuilds/games-arcade/jvgs/files/jvgs-0.5-path.patch
Michael Mair-Keimberger 1c5dd02604
games-arcade/jvgs: add 0.5.1
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>
2025-01-02 01:11:38 +01:00

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);