Indent xml for saving

This commit is contained in:
2025-03-18 23:04:47 +01:00
parent 1c6af27c7e
commit 6826b272aa
2 changed files with 11 additions and 4 deletions

View File

@@ -257,8 +257,15 @@ class ModList {
// Build the XML document
final xmlDocument = builder.buildDocument();
// Write the XML document to file
file.writeAsStringSync(xmlDocument.toString());
// Convert to string with 2-space indentation
final prettyXml = xmlDocument.toXmlString(
pretty: true,
indent: ' ', // 2 spaces
newLine: '\n',
);
// Write the formatted XML document to file
file.writeAsStringSync(prettyXml);
logger.info('Successfully saved mod configuration to: $configPath');
} catch (e) {
logger.error('Error saving configuration file: $e');