@@ -51,24 +51,32 @@ namespace mob::details {
5151
5252 // returns a string from conf, bails out if it doesn't exist
5353 //
54- std::string get_string (std::string_view section, std::string_view key)
54+ std::string get_string (std::string_view section, std::string_view key,
55+ std::optional<std::string> default_)
5556 {
5657 auto sitor = g_conf.find (section);
5758 if (sitor == g_conf.end ())
5859 gcx ().bail_out (context::conf, " [{}] doesn't exist" , section);
5960
6061 auto kitor = sitor->second .find (key);
61- if (kitor == sitor->second .end ())
62- gcx ().bail_out (context::conf, " no key '{}' in [{}]" , key, section);
62+ if (kitor == sitor->second .end ()) {
63+ if (!default_.has_value ()) {
64+ gcx ().bail_out (context::conf, " no key '{}' in [{}]" , key, section);
65+ }
66+ return *default_;
67+ }
6368
6469 return kitor->second ;
6570 }
6671
6772 // calls get_string(), converts to int
6873 //
69- int get_int (std::string_view section, std::string_view key)
74+ int get_int (std::string_view section, std::string_view key,
75+ std::optional<int > default_)
7076 {
71- const auto s = get_string (section, key);
77+ const auto s = get_string (section, key, default_.transform ([](auto v) {
78+ return std::to_string (v);
79+ }));
7280
7381 try {
7482 return std::stoi (s);
@@ -80,9 +88,12 @@ namespace mob::details {
8088
8189 // calls get_string(), converts to bool
8290 //
83- bool get_bool (std::string_view section, std::string_view key)
91+ bool get_bool (std::string_view section, std::string_view key,
92+ std::optional<bool > default_)
8493 {
85- const auto s = get_string (section, key);
94+ const auto s = get_string (section, key, default_.transform ([](auto v) {
95+ return v ? " true" : " false" ;
96+ }));
8697 return bool_from_string (s);
8798 }
8899
@@ -428,13 +439,8 @@ namespace mob {
428439
429440 MOB_ASSERT (!tasks.empty ());
430441
431- for (auto & t : tasks) {
432- if (t->name () != task &&
433- details::find_string_for_task (t->name (), key)) {
434- continue ;
435- }
442+ for (auto & t : tasks)
436443 details::set_string_for_task (t->name (), key, value);
437- }
438444 }
439445 else {
440446 // global task option
@@ -538,7 +544,7 @@ namespace mob {
538544 resolve_path (" install_licenses" , p.install_bin (), " licenses" );
539545 resolve_path (" install_pythoncore" , p.install_bin (), " pythoncore" );
540546 resolve_path (" install_stylesheets" , p.install_bin (), " stylesheets" );
541- resolve_path (" install_translations " , p.install_bin (), " translations " );
547+ resolve_path (" install_extensions " , p.install_bin (), " extensions " );
542548
543549 // finally, resolve the tools that are unlikely to be in PATH; all the
544550 // other tools (7z, jom, patch, etc.) are assumed to be in PATH (which
@@ -684,6 +690,11 @@ namespace mob {
684690 return {};
685691 }
686692
693+ conf_translations conf::translation ()
694+ {
695+ return {};
696+ }
697+
687698 conf_prebuilt conf::prebuilt ()
688699 {
689700 return {};
@@ -777,6 +788,8 @@ namespace mob {
777788
778789 conf_build_types::conf_build_types () : conf_section(" build-types" ) {}
779790
791+ conf_translations::conf_translations () : conf_section(" translations" ) {}
792+
780793 conf_prebuilt::conf_prebuilt () : conf_section(" prebuilt" ) {}
781794
782795 conf_paths::conf_paths () : conf_section(" paths" ) {}
0 commit comments