loolwsd/LOOLWSD.cpp | 23 +++-------------------- loolwsd/LOOLWSD.hpp | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 20 deletions(-)
New commits: commit e8ffea5d1c0d0f18334a6b07a804f66a251cf609 Author: Ashod Nakashian <[email protected]> Date: Wed Apr 6 18:17:59 2016 -0400 loolwsd: minor cleanup of path handling in config Change-Id: I6a858e819372326ab582af91ad55a8e84b81608d Reviewed-on: https://gerrit.libreoffice.org/23875 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 4a222e8..adcde45 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -990,30 +990,13 @@ void LOOLWSD::initialize(Application& self) void LOOLWSD::initializeSSL() { - auto& conf = config(); - - auto ssl_cert_file_path = conf.getString("ssl.cert_file_path"); - if (conf.getBool("ssl.cert_file_path[@relative]")) - { - ssl_cert_file_path = Poco::Path(Application::instance().commandPath()).parent().append(ssl_cert_file_path).toString(); - } - + const auto ssl_cert_file_path = getPathFromConfig("ssl.cert_file_path"); Log::info("SSL Cert file: " + ssl_cert_file_path); - auto ssl_key_file_path = conf.getString("ssl.key_file_path"); - if (conf.getBool("ssl.key_file_path[@relative]")) - { - ssl_key_file_path = Poco::Path(Application::instance().commandPath()).parent().append(ssl_key_file_path).toString(); - } - + const auto ssl_key_file_path = getPathFromConfig("ssl.key_file_path"); Log::info("SSL Key file: " + ssl_key_file_path); - auto ssl_ca_file_path = conf.getString("ssl.ca_file_path"); - if (conf.getBool("ssl.ca_file_path[@relative]")) - { - ssl_ca_file_path = Poco::Path(Application::instance().commandPath()).parent().append(ssl_ca_file_path).toString(); - } - + const auto ssl_ca_file_path = getPathFromConfig("ssl.ca_file_path"); Log::info("SSL CA file: " + ssl_ca_file_path); Poco::Crypto::initializeCrypto(); diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp index 59d7111..f4964bb 100644 --- a/loolwsd/LOOLWSD.hpp +++ b/loolwsd/LOOLWSD.hpp @@ -65,6 +65,22 @@ private: void displayHelp(); void displayVersion(); Poco::Process::PID createBroker(); + + /// Reads and processes path entries with the given property + /// from the configuration. + /// Converts relative paths to absolute. + //TODO: Move to a better namespace. + std::string getPathFromConfig(const std::string& property) const + { + auto path = config().getString(property); + if (config().hasProperty(property + "[@relative]") && + config().getBool(property + "[@relative]")) + { + path = Poco::Path(Application::instance().commandPath()).parent().append(path).toString(); + } + + return path; + } }; #endif _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
