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.
Type of Change
Description
This PR addresses issue #3654 by adding functionality to remember the last used directory for Import/Export operations.
Previously,
Invoke-WPFImpexwould always reset the file dialog's initial directory to the Desktop. This change modifies theConfigDialogfunction to:Check for a persistent user configuration file at
%LOCALAPPDATA%\Winutil\user_config.json.Load the
LastImportExportPathfrom 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
LastImportExportPathfrom the local user configuser_config.json.Sets the
InitialDirectoryof theSaveFileDialogorOpenFileDialogaccordingly.Writes the parent directory of the selected file back to
user_config.jsonupon 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
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