@@ -34,24 +34,32 @@ namespace mob::details {
3434
3535 // returns a string from conf, bails out if it doesn't exist
3636 //
37- std::string get_string (std::string_view section, std::string_view key)
37+ std::string get_string (std::string_view section, std::string_view key,
38+ std::optional<std::string> default_)
3839 {
3940 auto sitor = g_conf.find (section);
4041 if (sitor == g_conf.end ())
4142 gcx ().bail_out (context::conf, " [{}] doesn't exist" , section);
4243
4344 auto kitor = sitor->second .find (key);
44- if (kitor == sitor->second .end ())
45- gcx ().bail_out (context::conf, " no key '{}' in [{}]" , key, section);
45+ if (kitor == sitor->second .end ()) {
46+ if (!default_.has_value ()) {
47+ gcx ().bail_out (context::conf, " no key '{}' in [{}]" , key, section);
48+ }
49+ return *default_;
50+ }
4651
4752 return kitor->second ;
4853 }
4954
5055 // calls get_string(), converts to int
5156 //
52- int get_int (std::string_view section, std::string_view key)
57+ int get_int (std::string_view section, std::string_view key,
58+ std::optional<int > default_)
5359 {
54- const auto s = get_string (section, key);
60+ const auto s = get_string (section, key, default_.transform ([](auto v) {
61+ return std::to_string (v);
62+ }));
5563
5664 try {
5765 return std::stoi (s);
@@ -63,9 +71,12 @@ namespace mob::details {
6371
6472 // calls get_string(), converts to bool
6573 //
66- bool get_bool (std::string_view section, std::string_view key)
74+ bool get_bool (std::string_view section, std::string_view key,
75+ std::optional<bool > default_)
6776 {
68- const auto s = get_string (section, key);
77+ const auto s = get_string (section, key, default_.transform ([](auto v) {
78+ return v ? " true" : " false" ;
79+ }));
6980 return bool_from_string (s);
7081 }
7182
@@ -378,13 +389,8 @@ namespace mob {
378389
379390 MOB_ASSERT (!tasks.empty ());
380391
381- for (auto & t : tasks) {
382- if (t->name () != task &&
383- details::find_string_for_task (t->name (), key)) {
384- continue ;
385- }
392+ for (auto & t : tasks)
386393 details::set_string_for_task (t->name (), key, value);
387- }
388394 }
389395 else {
390396 // global task option
@@ -488,7 +494,7 @@ namespace mob {
488494 resolve_path (" install_licenses" , p.install_bin (), " licenses" );
489495 resolve_path (" install_pythoncore" , p.install_bin (), " pythoncore" );
490496 resolve_path (" install_stylesheets" , p.install_bin (), " stylesheets" );
491- resolve_path (" install_translations " , p.install_bin (), " translations " );
497+ resolve_path (" install_extensions " , p.install_bin (), " extensions " );
492498
493499 // finally, resolve the tools that are unlikely to be in PATH; all the
494500 // other tools (7z, jom, patch, etc.) are assumed to be in PATH (which
@@ -634,6 +640,11 @@ namespace mob {
634640 return {};
635641 }
636642
643+ conf_translations conf::translation ()
644+ {
645+ return {};
646+ }
647+
637648 conf_prebuilt conf::prebuilt ()
638649 {
639650 return {};
@@ -725,6 +736,8 @@ namespace mob {
725736
726737 conf_versions::conf_versions () : conf_section(" versions" ) {}
727738
739+ conf_translations::conf_translations () : conf_section(" translations" ) {}
740+
728741 conf_prebuilt::conf_prebuilt () : conf_section(" prebuilt" ) {}
729742
730743 conf_paths::conf_paths () : conf_section(" paths" ) {}
0 commit comments