Skip to content
This repository was archived by the owner on Sep 21, 2022. It is now read-only.

Made PluginSettings path keyword replacement more safe #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JashanChittesh
Copy link
Contributor

The problem with replacing the keywords on load is that this results in the keywords being persistently replaced when using the new SetGlobalValues(...) workflow for changing the settings during build time.

The approach suggested by this Pull request handles the keyword replacement by making the serialized members private, and doing the keyword replacement the first time the public property getter is called. This way, the persistent member variables are never altered and the final path will never be (accidentally) stored.

One additional benefit is that using Properties for these two values makes it obvious that the value received when getting the property may be different from the serialized member variable (because property getters are methods, so some processing can occur).

While at it, I also replaced the duplicate keyword replacement code with a single method.

The problem with replacing the keywords on load is that this results in the keywords being persistently replaced when using the new SetGlobalValues(...) workflow for changing the settings during build time.

The new approach handles this by making the serialized members private, and doing the keyword replacement the first time the property getter is called. This way, the persistent member variables are never altered and the final path will never be (accidentally) stored.

While at it, I also replaced the duplicate code with a single method.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant