Skip to content

Conversation

@ZeusCraft10
Copy link
Contributor

Type of Change

  • New feature
  • Bug fix
  • Documentation update
  • Refactoring
  • Hotfix
  • Security patch
  • 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

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

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

@GabiNun
Copy link
Contributor

GabiNun commented Dec 19, 2025

dont use try if the catch is going to be empty whats the point even it just amkes the code look uglier

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.

remember import/export folders between sessions

3 participants