Add a '-a' option that allows to override the program path (i.e. Application.Path and Args[0]).
[INTERPRETER] * NEW: Add a '-a' option that allows to override the program path (i.e. Application.Path and Args[0]).
This commit is contained in:
parent
f3587c71d7
commit
6586e7d7cc
@ -271,6 +271,7 @@ int main(int argc, char *argv[])
|
||||
printf(" -e evaluate an expression\n");
|
||||
|
||||
printf(
|
||||
" -a <path> override application path\n"
|
||||
" -g enter debugging mode\n"
|
||||
" -h --help display this help\n"
|
||||
" -H --httpd run through an embedded http server\n"
|
||||
@ -376,6 +377,9 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
PROJECT_run_tests = TRUE;
|
||||
}
|
||||
else if (is_option_arg(argv, argc, &i, 'a', NULL, &PROJECT_override))
|
||||
{
|
||||
}
|
||||
else if (is_option(argv[i], '-'))
|
||||
{
|
||||
i++;
|
||||
|
@ -60,6 +60,9 @@ static bool _daemon = FALSE;
|
||||
|
||||
BEGIN_PROPERTY(Application_Path)
|
||||
|
||||
if (PROJECT_override)
|
||||
GB_ReturnNewZeroString(FILE_get_dir(PROJECT_override));
|
||||
else
|
||||
GB_ReturnString(PROJECT_path);
|
||||
|
||||
END_PROPERTY
|
||||
@ -134,6 +137,8 @@ BEGIN_METHOD(Application_Args_get, GB_INTEGER index)
|
||||
|
||||
if (index >= PROJECT_argc)
|
||||
GB_ReturnVoidString();
|
||||
else if (index == 0 && PROJECT_override)
|
||||
GB_ReturnNewZeroString(FILE_get_name(PROJECT_override));
|
||||
else
|
||||
GB_ReturnConstZeroString(PROJECT_argv[index]);
|
||||
|
||||
|
@ -46,7 +46,6 @@
|
||||
|
||||
char *PROJECT_path = NULL;
|
||||
char *PROJECT_exec_path = NULL;
|
||||
|
||||
char *PROJECT_name = NULL;
|
||||
char *PROJECT_title = NULL;
|
||||
const char *PROJECT_startup = NULL;
|
||||
@ -62,6 +61,8 @@ char *PROJECT_oldcwd = NULL;
|
||||
bool PROJECT_run_httpd = FALSE;
|
||||
bool PROJECT_run_tests = FALSE;
|
||||
|
||||
const char *PROJECT_override = NULL;
|
||||
|
||||
static char *project_buffer;
|
||||
|
||||
//static char *project_ptr;
|
||||
|
@ -51,6 +51,7 @@ EXTERN char *PROJECT_oldcwd;
|
||||
EXTERN char *PROJECT_user_home;
|
||||
EXTERN bool PROJECT_run_httpd;
|
||||
EXTERN bool PROJECT_run_tests;
|
||||
EXTERN const char *PROJECT_override;
|
||||
#endif
|
||||
|
||||
void PROJECT_init(const char *file);
|
||||
|
Loading…
x
Reference in New Issue
Block a user