Skip to content

Commit

Permalink
Refactored path processing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Peguen committed Dec 20, 2024
1 parent 4b23137 commit bfd3b4f
Show file tree
Hide file tree
Showing 11 changed files with 149 additions and 229 deletions.
2 changes: 1 addition & 1 deletion app/play/play_core/include/ecal_play_logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class EcalPlayLogger
static const int MAXIMUM_ROTATING_FILES = 5;
static const int FIVE_MEGABYTES = 5 * 1024 * 1024;

auto ecal_data_path = eCAL::Util::GeteCALLogPath();
auto ecal_data_path = eCAL::Util::GeteCALLogDir();
std::string log_filename = ecal_data_path + EcalPlayGlobals::ECAL_PLAY_NAME + ".log";

// create console logger and rotating file logger with maximum size 5MB and maximum 5 rotating files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace eCAL
static const int MAXIMUM_ROTATING_FILES = 5;
static const int FIVE_MEGABYTES = 5 * 1024 * 1024;

auto ecal_data_path = eCAL::Util::GeteCALLogPath();
auto ecal_data_path = eCAL::Util::GeteCALLogDir();
std::string log_filename = ecal_data_path + ECAL_REC_NAME + ".log";

// create console logger and rotating file logger with maximum size 5MB and maximum 5 rotating files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace eCAL
static const int MAXIMUM_ROTATING_FILES = 5;
static const int FIVE_MEGABYTES = 5 * 1024 * 1024;

auto ecal_data_path = eCAL::Util::GeteCALLogPath();
auto ecal_data_path = eCAL::Util::GeteCALLogDir();
std::string log_filename = ecal_data_path + ecal_sys_client + ".log";

// create console logger and rotating file logger with maximum size 5MB and maximum 5 rotating files
Expand Down
2 changes: 1 addition & 1 deletion app/sys/sys_core/include/ecalsys/ecal_sys_logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class EcalSysLogger
static const int MAXIMUM_ROTATING_FILES = 5;
static const int FIVE_MEGABYTES = 5 * 1024 * 1024;

auto ecal_data_path = eCAL::Util::GeteCALLogPath();
auto ecal_data_path = eCAL::Util::GeteCALLogDir();
std::string log_filename = ecal_data_path + ECAL_SYS_LIB_NAME + ".log";

// create console logger and rotating file logger with maximum size 5MB and maximum 5 rotating files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ void ImportFromCloudWidget::import()

void ImportFromCloudWidget::loadExcludeTasksFilter()
{
std::string default_cfg_file_path = eCAL::Util::GeteCALActiveIniFile();
std::string default_cfg_file_path = eCAL::GetConfiguration().GetYamlFilePath();
QFile default_cfg_file(default_cfg_file_path.c_str());
if (default_cfg_file.exists())
{
Expand Down
2 changes: 1 addition & 1 deletion contrib/ecaltime/linuxptp/src/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace LinuxPtpConfig {
* @return the device value from the linuxptp section
*/
std::string getDevice() {
std::string path_to_ini = eCAL::Util::GeteCALConfigPath();
std::string path_to_ini = eCAL::Util::GeteCALConfigDir();
path_to_ini += "ecaltime.yaml";

YAML::Node yaml;
Expand Down
29 changes: 8 additions & 21 deletions ecal/core/include/ecal/ecal_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,16 @@ namespace eCAL
{
/**
* @brief Retrieve eCAL configuration path.
* This path is for the local eCAL configuration files
* like ecal.yaml.
*
* @return eCAL configuration path.
**/
ECAL_API std::string GeteCALConfigPath();

/**
* @brief Retrieve eCAL user configuration path.
* This is path is for the eCAL application settings files.
* This path has read/write permissions for standard users.
* Checks for a valid default configuration file (ecal.yaml) in the following paths:
* 1. ECAL_CONFIG_DIR environment variable path
* 2. Local user path (win: Appdata/Local, unix: ~/.ecal)
* 3. System paths like /etc/ecal, ProgramData/eCAL
*
* @return eCAL data path.
* @return First path that contains a valid config file.
* Returns empty string if no valid config file is found.
**/
ECAL_API std::string GeteCALUserSettingsPath();
ECAL_API std::string GeteCALConfigDir(); // ECAL_DATA PATH?

/**
* @brief Retrieve eCAL standard logging path.
Expand All @@ -59,15 +54,7 @@ namespace eCAL
*
* @return eCAL data path.
**/
ECAL_API std::string GeteCALLogPath();

/**
* @brief Retrieve full path to active eCAL ini file.
* Returns an empty string if no active ini file is found.
*
* @return eCAL active ini file name.
**/
ECAL_API std::string GeteCALActiveIniFile();
ECAL_API std::string GeteCALLogDir();

/**
* @brief Send shutdown event to specified local user process using it's unit name.
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/src/config/builder/logging_attribute_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace eCAL
{
// check ECAL_CONFIG
// Creates path if not exists
attributes.file_config.path = Util::GeteCALLogPath();
attributes.file_config.path = Util::GeteCALLogDir();
}

attributes.console_sink.enabled = log_config_.provider.console.enable;
Expand Down
Loading

0 comments on commit bfd3b4f

Please sign in to comment.