winutil icon indicating copy to clipboard operation
winutil copied to clipboard

Fix issue 3654

Open ZeusCraft10 opened this issue 1 month ago • 1 comments

Type of Change

  • [x] New feature
  • [ ] Bug fix
  • [ ] Documentation update
  • [ ] Refactoring
  • [ ] Hotfix
  • [ ] Security patch
  • [x] UI/UX improvement

Description

This PR addresses issue #3654 by adding functionality to remember the last used directory for Import/Export operations.

Previously, Invoke-WPFImpex would always reset the file dialog's initial directory to the Desktop. This change modifies the ConfigDialog function to:

Check for a persistent user configuration file at %LOCALAPPDATA%\Winutil\user_config.json. Load the LastImportExportPath from this config if it exists. Save the newly selected directory back to this config file after a successful selection. This improves the user experience by reducing the need to repeatedly navigate to the same folder when performing multiple import/export actions.

Link any related issues.]--> #3654

Testing

I implemented logic that:

Attempts to read LastImportExportPath from the local user config user_config.json. Sets the InitialDirectory of the SaveFileDialog or OpenFileDialog accordingly. Writes the parent directory of the selected file back to user_config.json upon a successful dialog result. Handles missing config files or directories gracefully (creating them if needed).

Impact

UX: significantly improves usability for users who keep their config files in specific folders other than the Desktop. Filesystem: Creates a lightweight JSON config file in AppData\Local.

Issue related to PR

  • Resolves #3654

Additional Information

The configuration is stored in a user_config.json file to allow for future expansion of persistent user settings without cluttering the main directory or registry.

Checklist

  • [x] My code adheres to the coding and style guidelines of the project.
  • [x] I have performed a self-review of my own code.
  • [x] I have commented my code, particularly in hard-to-understand areas.
  • [x] I have made corresponding changes to the documentation.
  • [x] My changes generate no errors/warnings/merge conflicts.

ZeusCraft10 avatar Dec 19 '25 15:12 ZeusCraft10