Skip to content

Fix sectionless files silently dropping all settings#6

Open
FIFER-Mods wants to merge 1 commit into
cdervis:mainfrom
FIFER-Mods:fix/sectionless-keys-dropped
Open

Fix sectionless files silently dropping all settings#6
FIFER-Mods wants to merge 1 commit into
cdervis:mainfrom
FIFER-Mods:fix/sectionless-keys-dropped

Conversation

@FIFER-Mods
Copy link
Copy Markdown

@FIFER-Mods FIFER-Mods commented Jun 7, 2026

A config with top-level settings but no [section] header parses to an empty Configuration:

var cfg = Configuration.LoadFromString("Foo = 1\nBar = 2");
cfg.SectionCount; // 0, settings dropped

The default section that holds those settings is only added to the config when a [section] header is read. With no header it's never added, so the settings are lost. This adds it after the parse loop.

The writer already omits the header for the default section, so these files round-trip unchanged.

@FIFER-Mods FIFER-Mods closed this Jun 7, 2026
@FIFER-Mods FIFER-Mods reopened this Jun 7, 2026
A config with top-level settings but no [section] header parsed to an
empty Configuration. The default section holding those settings is only
added when a [section] header is read, so with no header it was never
added. Add it after the parse loop instead.
@FIFER-Mods FIFER-Mods force-pushed the fix/sectionless-keys-dropped branch from 41ce070 to b89746c Compare June 7, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant