[seed] Bug #778176 - Fix System.programInvocationName
- From: Alan Knowles <alank src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seed] Bug #778176 - Fix System.programInvocationName
- Date: Tue, 7 Feb 2017 05:59:41 +0000 (UTC)
commit d890fcdeb5fafcb76beabb2aa315def187345c4a
Author: Emanuele Aina <emanuele aina collabora com>
Date: Tue Feb 7 13:59:19 2017 +0800
Bug #778176 - Fix System.programInvocationName
libseed/seed-engine.c | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index 5aa250d..5a8df7d 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -1754,8 +1754,10 @@ seed_parse_args(SeedEngine* eng, int* argc, char*** argv)
ret = FALSE;
}
- if (!eng->program_name)
- eng->program_name = g_strdup(*argv[0]);
+ if (!eng->program_name) {
+ int program_name_idx = *argc > 1 ? 1 : 0;
+ eng->program_name = g_strdup((*argv)[program_name_idx]);
+ }
g_option_context_free(option_context);
@@ -1811,6 +1813,15 @@ seed_init_constrained_with_context_and_group(gint* argc,
eng = (SeedEngine*) g_malloc(sizeof(SeedEngine));
+ context_group = group;
+
+ eng->context = context;
+ eng->global = JSContextGetGlobalObject(eng->context);
+ eng->group = context_group;
+ eng->search_path = NULL;
+ eng->program_name = NULL;
+ eng->importer_initialized = FALSE;
+
if ((argc != 0) && seed_parse_args(eng, argc, argv) == FALSE) {
SEED_NOTE(MISC, "failed to parse arguments.");
return FALSE;
@@ -1827,15 +1838,6 @@ seed_init_constrained_with_context_and_group(gint* argc,
pthread_key_create(&seed_next_gobject_wrapper_key, NULL);
- context_group = group;
-
- eng->context = context;
- eng->global = JSContextGetGlobalObject(eng->context);
- eng->group = context_group;
- eng->search_path = NULL;
- eng->program_name = NULL;
- eng->importer_initialized = FALSE;
-
function_proto
= (JSObjectRef) seed_simple_evaluate(eng->context, "Function.prototype",
NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]