Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#996) Create config directory if it doesn't exist #1045

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

corbob
Copy link
Member

@corbob corbob commented Apr 22, 2024

Description Of Changes

Create the C:\ProgramData\Chocolatey GUI\Config\ directory if it doesn't already exist.

Motivation and Context

LiteDatabase doesn't handle creating the directory if it's not there. And cannot create it's file if the parent directory doesn't exist.

Testing

  1. Delete C:\ProgramData\Chocolatey Gui\ directory.
  2. Launch Chocolatey GUI.
  3. Ensure it doesn't error.
  4. Delete C:\ProgramData\Chocolatey Gui\ directory.
  5. Run chocolateyguicli -?.
  6. Ensure Help is output by Chocolatey GUI CLI.

Operating Systems Testing

  • Windows 10
  • Windows 11

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added. - Added to internal manual testing document.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v2 compatibility checked?

Related Issue

Fixes #996

@corbob corbob requested a review from gep13 April 22, 2024 17:07
Copy link
Member

@gep13 gep13 left a comment

Choose a reason for hiding this comment

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

LGTM!

If the directory for a LiteDatabase doesn't exist, LiteDatabase will not
attempt to create it, and will throw an exception because it can't
create the file without the parent directory. This ensures that the
folder exists before trying to create the database.
@corbob corbob force-pushed the 996-check-config-dir branch from a8685e4 to 600b9f8 Compare April 24, 2024 16:10
Copy link
Member

@gep13 gep13 left a comment

Choose a reason for hiding this comment

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

LGTM!

@gep13 gep13 merged commit 529c961 into chocolatey:hotfix/2.1.1 Apr 26, 2024
2 checks passed
@gep13
Copy link
Member

gep13 commented Apr 26, 2024

@corbob thank you for getting this fixed up!

@corbob corbob deleted the 996-check-config-dir branch April 26, 2024 15:17
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