From 16a5ca2a5595cbf11cc9074b00baded789668997 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 8 Apr 2020 17:10:32 +0200 Subject: [PATCH] [libcalamares] Format floats with trailing digits - When writing YAML, given a float **always** write some decimal digits (e.g. "1.0" rather than "1") so that the type of the written-out thing stays float. - Avoids test failure with the sample `welcome.conf` file which reads 1.0 and would write out 1, which then led to type differences. --- src/libcalamares/utils/Yaml.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcalamares/utils/Yaml.cpp b/src/libcalamares/utils/Yaml.cpp index 92ce9e6a0..b33ca3137 100644 --- a/src/libcalamares/utils/Yaml.cpp +++ b/src/libcalamares/utils/Yaml.cpp @@ -266,7 +266,7 @@ dumpYamlElement( QFile& f, const QVariant& value, int indent ) } else if ( value.type() == QVariant::Type::Double ) { - f.write( QString::number( value.toDouble() ).toUtf8() ); + f.write( QString::number( value.toDouble(), 'f', 2 ).toUtf8() ); } else if ( value.canConvert( QVariant::Type::ULongLong ) ) {