blob: 30e5cf8cdb97c191739686eefeb6da653b543b0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
--- 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);
|