[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 81e3462 5/7: Specify a default data directory
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 81e3462 5/7: Specify a default data directory for CGI |
Date: |
Wed, 7 Oct 2020 19:36:14 -0400 (EDT) |
branch: master
commit 81e346219ddb64b5c33a1879cdb6ee7f864d8e28
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Specify a default data directory for CGI
Hardcoded '/opt/lmi/data' as the data directory, as several unit tests
already do. For code actually deployed in production this wouldn't be
good enough, but for CGI it is.
This commit addresses a real problem. Without it, the data directory for
'make cgi_tests' defaulted to '.', the build directory, into which the
makefile copied '/opt/lmi/data/configurable_settings.xml', whereas, for
'make cgi_tests', '/opt/lmi/data/configurable_settings.xml' itself is
specified as a '--data_path=' command-line option. Thus, these similar
targets used different configuration files, which seemed to work as long
as one was a copy of the other. However, running a pc-linux-gnu native
build of lmi altered the configuration file in '/opt/lmi/data', which
was then copied to every build directory. Copying the original msw
version to '/opt/lmi/data' made the 'cli_tests' target work again for
msw, but not the 'cgi_tests' target.
Running a pc-linux-gnu build shouldn't break the lmi configuration file
for *-w64-mingw32, of course; but that's a separate problem.
---
main_cgi.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/main_cgi.cpp b/main_cgi.cpp
index f0719a6..7ef87bf 100644
--- a/main_cgi.cpp
+++ b/main_cgi.cpp
@@ -35,6 +35,7 @@
#include "alert.hpp"
#include "configurable_settings.hpp"
+#include "global_settings.hpp"
#include "illustrator.hpp"
#include "input.hpp"
#include "lmi.hpp" // is_antediluvian_fork()
@@ -89,6 +90,8 @@ int try_main(int argc, char* argv[])
try {
initialize_filesystem();
+ global_settings::instance().set_data_directory("/opt/lmi/data");
+
gLogFile.rdbuf()->open
(configurable_settings::instance().cgi_bin_log_filename().c_str()
,ios_out_trunc_binary()
- [lmi-commits] [lmi] master updated (61f5559 -> 14d582d), Greg Chicares, 2020/10/07
- [lmi-commits] [lmi] master ff1dd28 1/7: Improve measurement of compound-interest performance, Greg Chicares, 2020/10/07
- [lmi-commits] [lmi] master 7846a21 2/7: Fix defect introduced 20201004T1606Z: typo in variable name, Greg Chicares, 2020/10/07
- [lmi-commits] [lmi] master b8061ca 3/7: Treat gcc versions "10" and "10.0" as the same, Greg Chicares, 2020/10/07
- [lmi-commits] [lmi] master 9a6cab4 4/7: Treat gcc versions "[89]" and "[89]\.*" as the same, Greg Chicares, 2020/10/07
- [lmi-commits] [lmi] master 81e3462 5/7: Specify a default data directory for CGI,
Greg Chicares <=
- [lmi-commits] [lmi] master 14d582d 7/7: Trap exceptions from filesystem library, Greg Chicares, 2020/10/07
- [lmi-commits] [lmi] master c85b44f 6/7: Force print directory more sensibly, Greg Chicares, 2020/10/07