GUI: Process empty log path and gracefully process unreadable paths

This commit is contained in:
Eugene Sandulenko 2023-03-27 00:24:11 +02:00
parent d71accf00d
commit 5751768dc5
No known key found for this signature in database
GPG key ID: 014D387312D34F08
2 changed files with 10 additions and 1 deletions

View file

@ -2506,7 +2506,10 @@ void GlobalOptionsDialog::addPathsControls(GuiObject *boss, const Common::String
if (colorOverride)
_logPath->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
new ButtonWidget(boss, prefix + "ViewButton", _("View"), Common::U32String(), kViewLogCmd);
ButtonWidget *viewButton = new ButtonWidget(boss, prefix + "ViewButton", _("View"), Common::U32String(), kViewLogCmd);
if (logPath.empty())
viewButton->setEnabled(false);
Common::U32String browserPath = _("<default>");
if (ConfMan.hasKey("browser_lastpath"))

View file

@ -75,6 +75,12 @@ bool TextViewerDialog::loadFile(Common::String &fname) {
Common::SeekableReadStream *stream = file.createReadStream();
if (!stream) {
warning("TextViewerDialog::loadFile(): Cannot load file %s", fname.c_str());
return false;
}
warning("TextViewerDialog::loadFile(): File size is: %ld", stream->size());
_linesArray.clear();