[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 0c2d6b4 30/33: Revert "Revert "Trap exception
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 0c2d6b4 30/33: Revert "Revert "Trap exceptions from filesystem library"" |
Date: |
Mon, 3 May 2021 08:15:56 -0400 (EDT) |
branch: master
commit 0c2d6b415b881858794a2a9713eac962f8f54a45
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Revert "Revert "Trap exceptions from filesystem library""
This reverts commit dab074e388422f328933752ae6965560e2c9a62e.
Apparently that commit was intended as a simplification only: it removed
complicated code that couldn't actually have any effect. Normally, that
would be accepted without question. Furthermore, the code it removed
made configurable_settings fragile, as discussed in this thread:
https://lists.nongnu.org/archive/html/lmi/2020-10/msg00037.html
and, normally, that would cause it to be embraced with enthusiasm.
However, given '/opt/lmi/data/configurable_settings.xml' contents:
<default_input_filename>Z:/etc/opt/lmi/default.ill</default_input_...
<print_directory>Z:/opt/lmi/print</print_directory>
lmi-gtk's GUI now shows
Input defaults: /opt/lmi/bin/Z:/etc/opt/lmi/default.ill
Printout directory: /opt/lmi/print
where one textcontrol is as intended but the other is not. It is not
clear whether the reverted commit has anything to do with that, but
it seems wise to back it out temporarily pending investigation of this
anomaly. The present commit can be reverted (enthusiastically) later.
---
configurable_settings.cpp | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/configurable_settings.cpp b/configurable_settings.cpp
index df5e574..2eb49ee 100644
--- a/configurable_settings.cpp
+++ b/configurable_settings.cpp
@@ -143,12 +143,26 @@ configurable_settings::configurable_settings()
ascribe_members();
load();
- default_input_filename_ = fs::absolute(default_input_filename_ ).string();
- print_directory_ = remove_alien_msw_root(print_directory_).string();
- print_directory_ = fs::absolute(print_directory_ ).string();
+ try
+ {
+ default_input_filename_ =
fs::absolute(default_input_filename_).string();
+// Performing this test seems like a good idea, but it would flag
+// an empty path as an error.
+// validate_filepath(default_input_filename_, "Default input file");
+ }
+ catch(...)
+ {
+ report_exception();
+ // Silently replace invalid path with an empty string,
+ // which will produce an informative diagnostic when
+ // a default is needed.
+ default_input_filename_ = {};
+ }
try
{
+ print_directory_ = remove_alien_msw_root(print_directory_).string();
+ print_directory_ = fs::absolute(print_directory_).string();
validate_directory(print_directory_, "Print directory");
}
catch(...)
- [lmi-commits] [lmi] master e4d2f31 08/33: Rename a function, (continued)
- [lmi-commits] [lmi] master e4d2f31 08/33: Rename a function, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 2038991 15/33: Improve concinnity, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 9235f33 16/33: Avoid implicit conversion to fs::path, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 4ab2c4e 20/33: Further improve modify_directory() documentation, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master b64436f 19/33: Improve modify_directory() documentation and tests, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 0e3d61a 21/33: Rework modify_directory() documentation; augment unit test, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 40096c3 24/33: Conserve 70-character comment width, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 4473403 29/33: Improve output spacing, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master bc805ad 28/33: Augment path-validation unit test, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 6fd9f69 32/33: Remove the last occurrence of /name.check/, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 0c2d6b4 30/33: Revert "Revert "Trap exceptions from filesystem library"",
Greg Chicares <=
- [lmi-commits] [lmi] master bfa1255 27/33: Enable some tests that were conditionally suppressed, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 8538df8 31/33: Improve unit tests and their documentation, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 6ddb0fa 25/33: Rework a 'wine' workaround again, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 0296ac4 33/33: Deboostify still more, Greg Chicares, 2021/05/03