Skip to content

fix: FileAccessor SavePath#31

Merged
kochounoyume merged 1 commit intomainfrom
feature/fix-fileaccessor-savepath
Jul 4, 2025
Merged

fix: FileAccessor SavePath#31
kochounoyume merged 1 commit intomainfrom
feature/fix-fileaccessor-savepath

Conversation

@kochounoyume
Copy link
Member

No description provided.

@kochounoyume kochounoyume self-assigned this Jul 4, 2025
Copilot AI review requested due to automatic review settings July 4, 2025 17:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 from FileAccessor
  • Update DefaultFileAccessor and CryptoFileAccessor to override SavePath instead of passing it to the base
  • Simplify LSAccessor constructor to assign SavePath directly

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 SavePath property instead of the removed constructor argument.
public abstract class FileAccessor

src/LocalPrefs/FileAccessor.cs:53

  • Consider adding a unit test to verify that ReadAllBytes returns 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.SavePath returns the provided path and that ReadAllBytes correctly delegates to LSUtils using SavePath.
        public LSAccessor(in string path) => SavePath = path;

@kochounoyume kochounoyume merged commit 125f620 into main Jul 4, 2025
4 checks passed
@kochounoyume kochounoyume deleted the feature/fix-fileaccessor-savepath branch July 4, 2025 17:18
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.

2 participants