From c5d0362df51d6a7d97413c985e3a4295c6d9955d Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Tue, 24 Apr 2018 11:44:28 +0200 Subject: [PATCH] ui: Fixed crash in FilePath::makeCanonical and QtPathListBox making all settings paths relative --- src/lib/utility/file/FilePath.cpp | 10 +++++++++- src/lib_gui/qt/element/QtPathListBox.cpp | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/utility/file/FilePath.cpp b/src/lib/utility/file/FilePath.cpp index f8f7fcb3..e3e863f3 100644 --- a/src/lib/utility/file/FilePath.cpp +++ b/src/lib/utility/file/FilePath.cpp @@ -186,7 +186,15 @@ FilePath& FilePath::makeCanonical() } } #else - canonicalPath = boost::filesystem::canonical(getPath()); + try + { + canonicalPath = boost::filesystem::canonical(getPath()); + } + catch (boost::filesystem::filesystem_error e) + { + LOG_ERROR_STREAM(<< e.what()); + return *this; + } #endif m_path = std::make_unique(canonicalPath); m_canonicalized = true; diff --git a/src/lib_gui/qt/element/QtPathListBox.cpp b/src/lib_gui/qt/element/QtPathListBox.cpp index 2d98b19d..5526ceaf 100644 --- a/src/lib_gui/qt/element/QtPathListBox.cpp +++ b/src/lib_gui/qt/element/QtPathListBox.cpp @@ -61,7 +61,6 @@ void QtPathListBox::setPaths(const std::vector& list, bool readOnly) for (FilePath path : list) { - makeRelative(path); QtListBoxItem* item = addListBoxItemWithText(QString::fromStdWString(path.wstr())); item->setReadOnly(readOnly); }