Tommy icon indicating copy to clipboard operation
Tommy copied to clipboard

Tables that are not loaded inline as write inline

Open HUD-Software opened this issue 1 year ago • 0 comments

Considering a toml file like this that is valid:

[package]
authors = [ "me", "I", "myself" ]
name = "proj"
version = "0.0.1"

[profile.debug]
sanitizer = true
coverage = true

[profile.release]
sanitizer = false
coverage = false

[profile.debug-opt]

When it loaded and save, the toml is broken. The example code :

using Tommy;

TomlTable table;

using(StreamReader reader = File.OpenText("file.toml"))
{
    table = TOML.Parse(reader);
}

using (var file = File.OpenWrite("save.toml"))
{
    using StreamWriter sw = new(file);
    table.WriteTo(sw);
}

The resulting toml file is not correct:

[package]
authors = [ "me", "I", "myself" ]
name = "proj"
version = "0.0.1"
profile = { debug = { sanitizer = true, coverage = true }, release = { sanitizer = false, coverage = false }, debug-opt = {} }

Table that are not inline in original, should not be inlined when writing it.

HUD-Software avatar Jun 12 '23 08:06 HUD-Software