summaryrefslogtreecommitdiff
path: root/make/common.pm
diff options
context:
space:
mode:
Diffstat (limited to 'make/common.pm')
-rw-r--r--make/common.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/make/common.pm b/make/common.pm
index d5a2f06c7..f0174e0b3 100644
--- a/make/common.pm
+++ b/make/common.pm
@@ -31,10 +31,13 @@ use Exporter qw(import);
use File::Path qw(mkpath);
use File::Spec::Functions qw(rel2abs);
+use make::console;
+
our @EXPORT = qw(create_directory
get_cpu_count
get_version
read_config_file
+ write_config_file
module_installed);
sub create_directory($$) {
@@ -121,4 +124,15 @@ sub read_config_file($) {
return %config;
}
+sub write_config_file($%) {
+ my $path = shift;
+ my %config = @_;
+ open(my $fh, '>', $path) or print_error "unable to write to $path: $!";
+ while (my ($key, $value) = each %config) {
+ $value //= '';
+ say $fh "$key $value";
+ }
+ close $fh;
+}
+
1;