diff options
Diffstat (limited to 'src/setup/gnunet-setup.c')
-rw-r--r-- | src/setup/gnunet-setup.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/setup/gnunet-setup.c b/src/setup/gnunet-setup.c index 99f6a9fc..547f7441 100644 --- a/src/setup/gnunet-setup.c +++ b/src/setup/gnunet-setup.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include "gnunet-setup-transport.h" | 27 | #include "gnunet-setup-transport.h" |
28 | #include "gnunet-setup-options.h" | 28 | #include "gnunet-setup-options.h" |
29 | #include <gnunet/gnunet_constants.h> | 29 | #include <gnunet/gnunet_constants.h> |
30 | #include <gnunet/gnunet_directories.h> | ||
31 | #include <regex.h> | 30 | #include <regex.h> |
32 | #if ENABLE_NLS | 31 | #if ENABLE_NLS |
33 | #include <locale.h> | 32 | #include <locale.h> |
@@ -42,7 +41,7 @@ static struct GNUNET_GTK_MainLoop *ml; | |||
42 | /** | 41 | /** |
43 | * Name of the configuration file. | 42 | * Name of the configuration file. |
44 | */ | 43 | */ |
45 | static const char *cfgName; | 44 | static const char *option_cfg_name; |
46 | 45 | ||
47 | /** | 46 | /** |
48 | * Our configuration. | 47 | * Our configuration. |
@@ -341,7 +340,8 @@ write_configuration () | |||
341 | 340 | ||
342 | cfgDefault = GNUNET_CONFIGURATION_create (); | 341 | cfgDefault = GNUNET_CONFIGURATION_create (); |
343 | (void) GNUNET_CONFIGURATION_load (cfgDefault, NULL); /* load defaults only */ | 342 | (void) GNUNET_CONFIGURATION_load (cfgDefault, NULL); /* load defaults only */ |
344 | ret = GNUNET_CONFIGURATION_write_diffs (cfgDefault, cfg, cfgName); | 343 | ret = GNUNET_CONFIGURATION_write_diffs (cfgDefault, cfg, |
344 | option_cfg_name); | ||
345 | GNUNET_CONFIGURATION_destroy (cfgDefault); | 345 | GNUNET_CONFIGURATION_destroy (cfgDefault); |
346 | return ret; | 346 | return ret; |
347 | } | 347 | } |
@@ -542,7 +542,7 @@ GNUNET_setup_launch_edit_friends_button_clicked_cb (GtkButton *button, | |||
542 | GNUNET_OS_INHERIT_STD_ALL, | 542 | GNUNET_OS_INHERIT_STD_ALL, |
543 | NULL, NULL, | 543 | NULL, NULL, |
544 | "gnunet-peerinfo-gtk", | 544 | "gnunet-peerinfo-gtk", |
545 | "-c", cfgName, | 545 | "-c", option_cfg_name, |
546 | NULL); | 546 | NULL); |
547 | if (NULL == proc) | 547 | if (NULL == proc) |
548 | { | 548 | { |
@@ -600,7 +600,7 @@ run (void *cls, | |||
600 | if (GNUNET_OK != GNUNET_GTK_main_loop_build_window (ml, NULL)) | 600 | if (GNUNET_OK != GNUNET_GTK_main_loop_build_window (ml, NULL)) |
601 | return; | 601 | return; |
602 | 602 | ||
603 | cfgName = GNUNET_GTK_main_loop_get_configuration_file (ml); | 603 | option_cfg_name = GNUNET_GTK_main_loop_get_configuration_file (ml); |
604 | cfg = GNUNET_CONFIGURATION_create (); | 604 | cfg = GNUNET_CONFIGURATION_create (); |
605 | 605 | ||
606 | #ifndef MINGW | 606 | #ifndef MINGW |
@@ -612,7 +612,9 @@ run (void *cls, | |||
612 | our configuration file */ | 612 | our configuration file */ |
613 | if (GNUNET_YES == | 613 | if (GNUNET_YES == |
614 | GNUNET_DISK_file_test ("/etc/gnunet.conf")) | 614 | GNUNET_DISK_file_test ("/etc/gnunet.conf")) |
615 | { | ||
615 | (void) GNUNET_CONFIGURATION_load (cfg, "/etc/gnunet.conf"); | 616 | (void) GNUNET_CONFIGURATION_load (cfg, "/etc/gnunet.conf"); |
617 | } | ||
616 | else | 618 | else |
617 | { | 619 | { |
618 | #if HAVE_GETPWNAM | 620 | #if HAVE_GETPWNAM |
@@ -621,25 +623,32 @@ run (void *cls, | |||
621 | pw = getpwnam ("gnunet"); | 623 | pw = getpwnam ("gnunet"); |
622 | if (NULL != pw) | 624 | if (NULL != pw) |
623 | { | 625 | { |
624 | char *cfgname; | 626 | char *gnunet_user_cfgname; |
625 | 627 | ||
626 | GNUNET_asprintf (&cfgname, | 628 | GNUNET_asprintf (&gnunet_user_cfgname, |
627 | "%s%s%s", | 629 | "%s%s%s", |
628 | pw->pw_dir, | 630 | pw->pw_dir, |
629 | DIR_SEPARATOR_STR, | 631 | DIR_SEPARATOR_STR, |
630 | ".config/gnunet.conf"); | 632 | ".config/gnunet.conf"); |
631 | (void) GNUNET_CONFIGURATION_load (cfg, cfgname); | 633 | if (GNUNET_YES == |
632 | GNUNET_free (cfgname); | 634 | GNUNET_DISK_file_test (gnunet_user_cfgname)) |
635 | (void) GNUNET_CONFIGURATION_load (cfg, gnunet_user_cfgname); | ||
636 | GNUNET_free (gnunet_user_cfgname); | ||
633 | } | 637 | } |
634 | #endif | 638 | #endif |
635 | } | 639 | } |
636 | (void) GNUNET_CONFIGURATION_parse (cfg, cfgName); | 640 | if (GNUNET_YES == |
641 | GNUNET_DISK_file_test (option_cfg_name)) | ||
642 | (void) GNUNET_CONFIGURATION_parse (cfg, | ||
643 | option_cfg_name); | ||
637 | } | 644 | } |
638 | else | 645 | else |
639 | #endif | 646 | #endif |
640 | { | 647 | { |
641 | /* only load system defaults and our configuration file */ | 648 | /* only load system defaults and our configuration file */ |
642 | (void) GNUNET_CONFIGURATION_load (cfg, cfgName); | 649 | if (GNUNET_YES == |
650 | GNUNET_DISK_file_test (option_cfg_name)) | ||
651 | (void) GNUNET_CONFIGURATION_load (cfg, option_cfg_name); | ||
643 | } | 652 | } |
644 | main_window = GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_dialog")); | 653 | main_window = GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_dialog")); |
645 | main_window = GNUNET_GTK_plug_me ("GNUNET_FS_GTK_PLUG", | 654 | main_window = GNUNET_GTK_plug_me ("GNUNET_FS_GTK_PLUG", |