Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors FileAccessor to replace its constructor-based savePath with an abstract SavePath property, ensuring each implementation overrides the new property.
- Introduce
protected internal abstract string SavePath { get; }and remove the primary constructor fromFileAccessor - Update
DefaultFileAccessorandCryptoFileAccessorto overrideSavePathinstead of passing it to the base - Simplify
LSAccessorconstructor to assignSavePathdirectly
Reviewed Changes
Copilot reviewed 3 out of 7 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/LocalPrefs/FileAccessor.cs | Removed primary constructor parameter and added abstract SavePath |
| src/LocalPrefs/CryptoFileAccessor.cs | Changed base call to override SavePath |
| src/LocalPrefs.Unity/Packages/jp.andantetribe.localprefs/Runtime/LSAccessor.cs | Simplified constructor and implemented SavePath override |
Comments suppressed due to low confidence (3)
src/LocalPrefs/FileAccessor.cs:7
- The class XML summary still refers to a constructor parameter that no longer exists; update the summary to describe the new abstract
SavePathproperty instead of the removed constructor argument.
public abstract class FileAccessor
src/LocalPrefs/FileAccessor.cs:53
- Consider adding a unit test to verify that
ReadAllBytesreturns an empty array when the file does not exist to cover this fallback behavior.
File.Exists(SavePath) ? File.ReadAllBytes(SavePath) : [];
src/LocalPrefs.Unity/Packages/jp.andantetribe.localprefs/Runtime/LSAccessor.cs:22
- Add tests to confirm that
LSAccessor.SavePathreturns the provided path and thatReadAllBytescorrectly delegates toLSUtilsusingSavePath.
public LSAccessor(in string path) => SavePath = path;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.