I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 45a38a54 authored by str4d's avatar str4d
Browse files

Only use original argc/v if there are arguments, otherwise use launch.properties or defaults

parent 7f471910
No related branches found
No related tags found
No related merge requests found
...@@ -32,13 +32,13 @@ extern int launchJVM(int, char**); ...@@ -32,13 +32,13 @@ extern int launchJVM(int, char**);
int int
main(int argc, char** argv) { main(int argc, char** argv) {
//int read_options_size; int read_options_size;
//char** read_options; char** read_options;
int ret = 0; int ret = 0;
//int current_argc = 0; //int current_argc = 0;
//int new_argc; int new_argc;
//char** new_argv; char** new_argv;
//int i; int i;
#ifdef _WIN32 #ifdef _WIN32
char currentDirectory[MAX_PATH+1]; char currentDirectory[MAX_PATH+1];
#endif #endif
...@@ -48,33 +48,37 @@ main(int argc, char** argv) { ...@@ -48,33 +48,37 @@ main(int argc, char** argv) {
SetWorkingDirectory(currentDirectory); SetWorkingDirectory(currentDirectory);
#endif #endif
// Read in options from disk (launch.properties) // If there are command-line arguments, just use them
// or the default ones (if no launch.properties existed) if(argc > 1) {
//readOptions(&read_options, &read_options_size); ret = launchJVM(argc, argv);
} else {
// Construct a new argc & argv to pass to launchJVM // Read in options from disk (launch.properties)
//new_argc = read_options_size + argc; // or the default ones (if no launch.properties existed)
//new_argv = (char**)MemAlloc(sizeof(char*) * (new_argc+1)); readOptions(&read_options, &read_options_size);
// copy process name // Construct a new argc & argv to pass to launchJVM
//new_argv[0] = argv[0]; new_argc = read_options_size;
// copy arguments from properties file new_argv = (char**)MemAlloc(sizeof(char*) * (new_argc+1));
//for(i = 1; i <= read_options_size; i++)
// new_argv[i] = read_options[i-1]; // copy process name
// copy argv arguments as arguments after the properties file new_argv[0] = argv[0];
// (generally used as arguments for I2P) // copy arguments from properties file
//for(current_argc = 1; current_argc < argc; current_argc++) for(i = 1; i <= read_options_size; i++)
// new_argv[i++] = argv[current_argc]; new_argv[i] = read_options[i-1];
// copy argv arguments as arguments after the properties file
//new_argv[i] = NULL; // (generally used as arguments for I2P)
//for(current_argc = 1; current_argc < argc; current_argc++)
// options are no longer necessary -- free them up. // new_argv[i++] = argv[current_argc];
//if(read_options != 0)
// free(read_options); new_argv[i] = NULL;
//ret = launchJVM(new_argc, new_argv); // options are no longer necessary -- free them up.
//free(new_argv); if(read_options != 0)
ret = launchJVM(argc, argv); free(read_options);
ret = launchJVM(new_argc, new_argv);
free(new_argv);
}
switch(ret) { switch(ret) {
case ERROR_COULDNT_FIND_JVM: case ERROR_COULDNT_FIND_JVM:
case ERROR_COULDNT_INITIALIZE_JVM: case ERROR_COULDNT_INITIALIZE_JVM:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment