Launcher !
This commit is contained in:
parent
64928852ba
commit
1c4b2d9846
2
.gitignore
vendored
2
.gitignore
vendored
@ -9,5 +9,7 @@
|
||||
/Models
|
||||
/Models/**.*
|
||||
|
||||
/launcher/src/main.exe
|
||||
|
||||
/Telephone-*.jar
|
||||
/hs_err_pid*
|
||||
|
||||
BIN
launcher/jdk.zip
Normal file
BIN
launcher/jdk.zip
Normal file
Binary file not shown.
44
launcher/src/main.c
Normal file
44
launcher/src/main.c
Normal file
@ -0,0 +1,44 @@
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
#include<string.h>
|
||||
#include<unistd.h>
|
||||
|
||||
#define MAX_PATH_SIZE 250
|
||||
#define LOG_HOLDER_SIZE 500
|
||||
|
||||
void logVar(char * message, char * var);
|
||||
|
||||
int main(){
|
||||
char currentWorkingDirectory[MAX_PATH_SIZE];
|
||||
if(getcwd(currentWorkingDirectory,sizeof(currentWorkingDirectory)) != NULL){
|
||||
} else {
|
||||
printf("Failed to get current working directory!\n");
|
||||
fflush(stdout);
|
||||
return 1;
|
||||
}
|
||||
//printf("CWD: %s\n",currentWorkingDirectory);
|
||||
//fflush(stdout);
|
||||
//get java location
|
||||
char javaPath[MAX_PATH_SIZE + 50];
|
||||
strcpy(javaPath,currentWorkingDirectory);
|
||||
strcat(javaPath,"\\jdk\\bin\\java.exe\0");
|
||||
//get jar location
|
||||
char jarPath[MAX_PATH_SIZE + 50];
|
||||
strcpy(jarPath,currentWorkingDirectory);
|
||||
strcat(jarPath,"\\Renderer.jar");
|
||||
logVar("javaPath: ",javaPath);
|
||||
logVar("jarPath: ",jarPath);
|
||||
printf("%s\n",jarPath);
|
||||
fflush(stdout);
|
||||
execlp(javaPath,"java","-jar",jarPath, (char *)NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char logHolder[LOG_HOLDER_SIZE];
|
||||
void logVar(char * message, char * var){
|
||||
strcpy(logHolder,message);
|
||||
strcat(logHolder,var);
|
||||
printf("%s\n",logHolder);
|
||||
fflush(stdout);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user