process the TemplateKey value before storing it #89
+2
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NOTE: This is a replacement PR as we erroneously purged the repo from #80 which should be closed in favor of this one)
Fix for incorrect File Key being generated when
TemplateKeys
have additional parameters that require processing. Previously, the File Key would be generated using the raw values of theTemplateKeys
- with this change it is generated with the processed value (usingstr_from_value()
).The way this manifests itself, specifically when executing a File Save... The app uses the File Key to determine any matching files that are currently present on the filesystem. It then calculates the
version_number
by using the highest value forversion_number
from all files that exist with the given File Key, and adding 1. If no files are found matching the File Key, then1
is used.For a
TemplateKey
defined as so:the raw value for
sg_asset_name_letter
will be "MyAssetName", while the processed value will be "M". (the subset isn't applied until you runstr_from_value()
). If your work template uses this key, when it writes out the files to the filesystem, they will be saved using "M" as the processed value.Then later when you execute a Save As... to try and version up, a File Key is generated for the current work file, which has
("sg_asset_name_letter", "MyAssetName")
in it. While the file saved on the filesystem will have("sg_asset_name_letter", "M")
in the File Key and will not be considered the same file. Therefor it will be incorrectly ignored when calculating the next version number.This fix ensures the File Key is generated with the processed value of the TemplateKeys so that they will always correctly match any files on the filesystem.