summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2019-05-10 12:56:01 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-05-10 13:16:21 -0400
commit580c5b3e1b8bc49dd5452c8a65a72452c534b4b5 (patch)
treeb8d2bad59db23ebcf1f3b17c2b6936379049138f /scripts
parent67424f61f8132215514e03ce1760d30356ac56d7 (diff)
kconfig: make parent directories for the saved .config as needed
With menuconfig / nconfig, users can input any file path from the "Save" menu, but it fails if the parent directory does not exist. Why not create the parent directory automatically. I think this is a user-friendly behavior. I changed the error messages in menuconfig / nconfig. "Nonexistent directory" is no longer the most likely reason of the failure. Perhaps, the user specified the existing directory, or attempted to write to the location without write permission. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/confdata.c3
-rw-r--r--scripts/kconfig/mconf.c2
-rw-r--r--scripts/kconfig/nconf.c3
3 files changed, 5 insertions, 3 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 399973e35533..d7bd353a8e50 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -881,6 +881,9 @@ int conf_write(const char *name)
881 return -1; 881 return -1;
882 } 882 }
883 883
884 if (make_parent_dir(name))
885 return -1;
886
884 env = getenv("KCONFIG_OVERWRITECONFIG"); 887 env = getenv("KCONFIG_OVERWRITECONFIG");
885 if (env && *env) { 888 if (env && *env) {
886 *tmpname = 0; 889 *tmpname = 0;
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 5f8c82a4cb08..694091f3ef9d 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -936,7 +936,7 @@ static void conf_save(void)
936 set_config_filename(dialog_input_result); 936 set_config_filename(dialog_input_result);
937 return; 937 return;
938 } 938 }
939 show_textbox(NULL, "Can't create file! Probably a nonexistent directory.", 5, 60); 939 show_textbox(NULL, "Can't create file!", 5, 60);
940 break; 940 break;
941 case 1: 941 case 1:
942 show_helptext("Save Alternate Configuration", save_config_help); 942 show_helptext("Save Alternate Configuration", save_config_help);
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index ac92c0ded6c5..cbafe3bf082e 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -1438,8 +1438,7 @@ static void conf_save(void)
1438 set_config_filename(dialog_input_result); 1438 set_config_filename(dialog_input_result);
1439 return; 1439 return;
1440 } 1440 }
1441 btn_dialog(main_window, "Can't create file! " 1441 btn_dialog(main_window, "Can't create file!",
1442 "Probably a nonexistent directory.",
1443 1, "<OK>"); 1442 1, "<OK>");
1444 break; 1443 break;
1445 case 1: 1444 case 1: