-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix winget after a call to winget settings export #2767
Changes from 4 commits
e20612e
619b387
a7b1363
342f32a
8de55f3
84b86f2
fda6d66
030cf63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,11 +106,11 @@ namespace AppInstaller::Settings | |
} | ||
catch (const std::exception& e) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This exposes the scenario where both the normal and backup settings fail, which can result in no output to the user about settings load failure? I think it just means an else for when the backup settings fails to load (~line 520 now) where we put in a different warning about not being able to load any settings file. |
||
{ | ||
AICLI_LOG(Core, Error, << "Failed to read " << setting.Name << "Reason: " << e.what()); | ||
AICLI_LOG(Core, Error, << "Failed to read " << setting.Name << "; Reason: " << e.what()); | ||
} | ||
catch (...) | ||
{ | ||
AICLI_LOG(Core, Error, << "Failed to read " << setting.Name << " Reason unknown."); | ||
AICLI_LOG(Core, Error, << "Failed to read " << setting.Name << "; Reason unknown."); | ||
} | ||
|
||
return {}; | ||
|
@@ -520,7 +520,13 @@ namespace AppInstaller::Settings | |
} | ||
else | ||
{ | ||
AICLI_LOG(Core, Warning, << "Failed loading settings files."); | ||
// Settings and back up didn't parse or exist. If they exist then warn the user. | ||
auto settingsPath = Stream{ Stream::PrimaryUserSettings }.GetPath(); | ||
auto backupPath = Stream{ Stream::BackupUserSettings }.GetPath(); | ||
if (std::filesystem::exists(settingsPath) || std::filesystem::exists(backupPath)) | ||
{ | ||
m_warnings.emplace_back(StringResource::String::SettingsWarningUsingDefault); | ||
} | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, I would think this would be better done using the output channels mechanism, but this is acceptable.
The nice thing about that mechanism being built out is that any error/exception could be output in a JSON format as well. But we have only so much time.