Closed rcoreilly closed 5 months ago
toml only adds to existing apparently. added a reset in SystemSettings Open method. d54055ad9
Not a working solution. This removes all support for default fav paths, so, for example, I now have no fav paths.
Given that the fav paths seem to get reset correctly after you restart the app, it doesn't seem like a toml loading problem.
Is it possible that something is going wrong with the SetToDefaults method? Have you checked whether DefaultPaths is somehow getting modified?
I pushed a soln: if empty after loading, set to defaults.
it is definitely just adding in toml -- I'm pretty sure I had this problem in other cases too... could do more research about that, but this should be workin gnow
I added a unit test to tomls: it is definitely not just adding: see https://github.com/cogentcore/core/commit/288f7e9a9fbbeddadb0d4c298d5d78a2f975dc1a.
it only is a problem for []struct not []string -- check out the updated test that shows the problem.
they have different save formats -- struct is separate [[Slice]] elements and it is clear from the format that it would have a hard time knowing when to reset.
Should we file this as an issue upstream?
no I think it is intrinsic to the format.
Regardless of how difficult it would be to fix, this is a violation of the standard go marshalling and umarshalling paradigm that people would expect, so there should at least be a disclaimer upstream.
it would have to have some kind of global var during outer loop of loading to detect when the first of each such slice element was encountered, and reset then. or just reset at the start. you could google about this further though. anyway, do you want to make the test pass or should i?
I filed the issue (https://github.com/pelletier/go-toml/issues/931).
The issue has been resolved (see https://github.com/pelletier/go-toml/pull/934 and 17911aa).
maybe when you change a setting? not clear.