lmi-commits
[Top][All Lists]
Advanced

[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()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]