feisty meow concerns codebase 2.140
configuration::application_configuration Class Reference

Defines installation-specific locations in the file system. More...

#include <application_configuration.h>

Inheritance diagram for configuration::application_configuration:
Collaboration diagram for configuration::application_configuration:

Public Member Functions

virtual ~application_configuration ()
 
 DEFINE_CLASS_NAME ("application_configuration")
 

Static Public Member Functions

static basis::astring application_name ()
 returns the full name of the current application.
 
static basis::astring application_directory ()
 returns the directory name where this application is running from.
 
static basis::un_int process_id ()
 returns the process id for this task, if that's relevant on the OS.
 
static structures::version get_OS_version ()
 returns the operating system's version information.
 
static basis::astring current_directory ()
 returns the current directory as reported by the operating system.
 
static const char * software_product_name ()
 This global function is available to the system at large for branding info.
 
static const char * APPLICATION_CONFIGURATION_FILENAME ()
 < returns the top-level directory of this installation.
 
static basis::astring application_configuration_file ()
 the fully specified path to the main path configuration file.
 
static basis::astring get_logging_directory ()
 < retrieves the core binary directory location from paths.ini.
 
static const basis::astringvirtual_unix_root ()
 returns the path to the unix root, which may be simulated.
 
static const basis::astringGLOBAL_SECTION_NAME ()
 the root section name for our configuration items in the main ini file.
 
static const basis::astringLOGGING_FOLDER_NAME ()
 the tag used for finding our logging path in the paths config file.
 
static const basis::astringDEFAULT_VIRTUAL_UNIX_ROOT ()
 default value if we don't find our setting for virtual root.
 
static basis::astring read_item (const basis::astring &key_name)
 returns the entry listed under the "key_name".
 
static basis::astring make_logfile_name (const basis::astring &base_name)
 generates an installation appropriate log file name from "base_name".
 
static basis::astring get_cmdline_from_proc ()
 retrieves the command line from the /proc hierarchy on linux.
 
static basis::astring query_for_process_info ()
 seeks out process info for a particular process.
 

Detailed Description

Defines installation-specific locations in the file system.

Definition at line 24 of file application_configuration.h.

Constructor & Destructor Documentation

◆ ~application_configuration()

virtual configuration::application_configuration::~application_configuration ( )
inlinevirtual

Definition at line 27 of file application_configuration.h.

Member Function Documentation

◆ application_configuration_file()

astring configuration::application_configuration::application_configuration_file ( )
static

the fully specified path to the main path configuration file.

the location of this file is determined by the directory where this executable is running. this is the only configuration file that should reside there, given the itchy vista compliance needs.

Definition at line 288 of file application_configuration.cpp.

References application_directory(), configuration::PATH_CONFIGURATION_FILENAME(), and filesystem::filename::raw().

Referenced by get_logging_directory(), and read_item().

◆ APPLICATION_CONFIGURATION_FILENAME()

static const char * configuration::application_configuration::APPLICATION_CONFIGURATION_FILENAME ( )
static

< returns the top-level directory of this installation.

< returns the folder containing the application directory (usually) as well as the other folders of configuration information and fonts and such needed by this installation. the configuration file provides a set of paths needed here. this file stores paths that the low-level libraries need for proper operation. this is just the base filename; the fully qualified path to the path configuration file is provided below.

◆ application_directory()

astring configuration::application_configuration::application_directory ( )
static

returns the directory name where this application is running from.

Definition at line 261 of file application_configuration.cpp.

References application_name(), filesystem::filename::dirname(), and filesystem::filename::raw().

Referenced by application_configuration_file(), main(), main(), and configuration::ini_configurator::name().

◆ application_name()

◆ current_directory()

astring configuration::application_configuration::current_directory ( )
static

returns the current directory as reported by the operating system.

Definition at line 233 of file application_configuration.cpp.

References getcwd, and MAX_ABS_PATH.

Referenced by versions::version_ini::one_stop_version_stamp().

◆ DEFAULT_VIRTUAL_UNIX_ROOT()

const astring & configuration::application_configuration::DEFAULT_VIRTUAL_UNIX_ROOT ( )
static

default value if we don't find our setting for virtual root.

this is bound to fail on many occasions if it's actually used on windoze for the default, but if we don't have good information ready, we can't just intuit the virtual unix root; we are not kreskin. the virtual unix environment could be MSYS, Cygwin, or others. Currently, if Cygwin is used during the build process, then the default should never be needed. support for other systems will be added as time permits and users clamor for them.

Definition at line 301 of file application_configuration.cpp.

References STATIC_STRING.

◆ DEFINE_CLASS_NAME()

configuration::application_configuration::DEFINE_CLASS_NAME ( "application_configuration"  )

◆ get_cmdline_from_proc()

◆ get_logging_directory()

astring configuration::application_configuration::get_logging_directory ( )
static

< retrieves the core binary directory location from paths.ini.

static basis::astring core_bin_directory(); returns the folder where the log files for the feisty meow system are stored. any log files should be written to this folder by the rest of the codebase, unless there are special purposes for those log files. but logs from general operation of feisty meow should be written in this directory.

Definition at line 344 of file application_configuration.cpp.

References application_configuration_file(), configuration::ini_configurator::APPLICATION_DIRECTORY, filesystem::filename::exists(), GLOBAL_SECTION_NAME(), LOG, LOGGING_FOLDER_NAME(), read_item(), filesystem::directory::recursive_create(), configuration::configurator::RETURN_ONLY, configuration::configurator::store(), textual::parser_bits::substitute_env_vars(), and basis::environment::TMP().

Referenced by loggers::default_critical_location(), and make_logfile_name().

◆ get_OS_version()

structures::version configuration::application_configuration::get_OS_version ( )
static

returns the operating system's version information.

for linux, this has: major/minor/release/revision as components. for ms-windows, this has: major/minor/platform_ID/build_number.

Definition at line 264 of file application_configuration.cpp.

Referenced by processes::process_control::find_process_in_list(), and processes::process_control::process_control().

◆ GLOBAL_SECTION_NAME()

const astring & configuration::application_configuration::GLOBAL_SECTION_NAME ( )
static

the root section name for our configuration items in the main ini file.

within the configuration file, there is a section named as above. this section should only be used to define path configuration entries that affect the general operation of the system. entries that are specific to particular programs or subsystems should be contained in their own section.

Definition at line 294 of file application_configuration.cpp.

References STATIC_STRING.

Referenced by get_logging_directory(), and read_item().

◆ LOGGING_FOLDER_NAME()

const astring & configuration::application_configuration::LOGGING_FOLDER_NAME ( )
static

the tag used for finding our logging path in the paths config file.

Definition at line 296 of file application_configuration.cpp.

References STATIC_STRING.

Referenced by get_logging_directory().

◆ make_logfile_name()

astring configuration::application_configuration::make_logfile_name ( const basis::astring base_name)
static

generates an installation appropriate log file name from "base_name".

creates and returns a full path name for a log file with the "base_name" specified, using the LOGGING_FOLDER_NAME() entry as the directory name. if the logging directory does not exist, it is created if that is possible. the returned name is suitable for logging mechanisms that need a filename. an empty string is returned on failure to create the directory.

Definition at line 389 of file application_configuration.cpp.

References base_name(), and get_logging_directory().

Referenced by loggers::file_logger::log_file_for_app_name().

◆ process_id()

basis::un_int configuration::application_configuration::process_id ( )
static

◆ query_for_process_info()

astring configuration::application_configuration::query_for_process_info ( )
static

◆ read_item()

astring configuration::application_configuration::read_item ( const basis::astring key_name)
static

returns the entry listed under the "key_name".

if the "key_name" is valid for the root configuration file, then this should always return an appropriate value. a failure is denoted by return of an empty string.

Definition at line 392 of file application_configuration.cpp.

References application_configuration_file(), configuration::ini_configurator::APPLICATION_DIRECTORY, GLOBAL_SECTION_NAME(), configuration::configurator::load(), configuration::configurator::RETURN_ONLY, and textual::parser_bits::substitute_env_vars().

Referenced by get_logging_directory().

◆ software_product_name()

const char * configuration::application_configuration::software_product_name ( )
static

This global function is available to the system at large for branding info.

Definition at line 252 of file application_configuration.cpp.

Referenced by configuration::ini_configurator::name().

◆ virtual_unix_root()

const astring & configuration::application_configuration::virtual_unix_root ( )
static

returns the path to the unix root, which may be simulated.

on unix, this will just return '/'. on win32 with cygwin installed, this will return the cygwin path for '/' that was detected at build time. this is often "c:/cygwin", which we use as a default if the path isn't detected properly.

Definition at line 311 of file application_configuration.cpp.


The documentation for this class was generated from the following files: