1 #ifndef APPLICATION_CONFIGURATION_GROUP
2 #define APPLICATION_CONFIGURATION_GROUP
5 * Name: path configuration definitions
6 * Author: Chris Koeritz
8 * Copyright (c) 2000-$now By Author. This program is free software; you can
9 * redistribute it and/or modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either version 2 of
11 * the License or (at your option) any later version. This is online at:
12 * http://www.fsf.org/copyleft/gpl.html
13 * Please send any updates to: fred@gruntose.com
16 #include <basis/astring.h>
17 #include <basis/definitions.h>
18 #include <structures/version_record.h>
20 namespace configuration {
22 //! Defines installation-specific locations in the file system.
24 class application_configuration : public virtual basis::root_object
27 virtual ~application_configuration() {}
29 // these methods are mainly about the application itself.
31 static basis::astring application_name();
32 //!< returns the full name of the current application.
34 static basis::astring application_directory();
35 //!< returns the directory name where this application is running from.
37 static basis::un_int process_id();
38 //!< returns the process id for this task, if that's relevant on the OS.
40 // these interface with the operating system.
42 static structures::version get_OS_version();
43 //!< returns the operating system's version information.
44 /*!< for linux, this has: major/minor/release/revision as components.
45 for ms-windows, this has: major/minor/platform_ID/build_number. */
47 static basis::astring current_directory();
48 //!< returns the current directory as reported by the operating system.
50 // the following are more about the installation than this application...
52 static const char *software_product_name();
53 //!< This global function is available to the system at large for branding info.
55 // static basis::astring installation_root();
56 //!< returns the top-level directory of this installation.
57 /*!< returns the folder containing the application directory (usually) as
58 well as the other folders of configuration information and fonts and
59 such needed by this installation. */
61 static const char *APPLICATION_CONFIGURATION_FILENAME();
62 //!< the configuration file provides a set of paths needed here.
63 /*!< this file stores paths that the low-level libraries need for
64 proper operation. this is just the base filename; the fully qualified
65 path to the path configuration file is provided below. */
67 static basis::astring application_configuration_file();
68 //!< the fully specified path to the main path configuration file.
69 /*!< the location of this file is determined by the directory where this
70 executable is running. this is the only configuration file that should
71 reside there, given the itchy vista compliance needs. */
73 //// static basis::astring core_bin_directory();
74 //!< retrieves the core binary directory location from paths.ini.
76 static basis::astring get_logging_directory();
77 //!< returns the directory where log files will be stored.
79 // the following are key names within the main configuration file.
81 static const basis::astring &GLOBAL_SECTION_NAME();
82 //!< the root section name for our configuration items in the main ini file.
83 /*!< within the configuration file, there is a section named as above.
84 this section should only be used to define path configuration entries that
85 affect the general operation of the system. entries that are specific
86 to particular programs or subsystems should be contained in their own
89 /// static const basis::astring &LOCAL_FOLDER_NAME();
90 //!< entry name in the config file that points at the installation root.
91 /*!< this is where all files for this product are stored on "this" machine. */
93 static const basis::astring &LOGGING_FOLDER_NAME();
94 //!< the location where the log files for the system are stored.
95 /*!< this is always considered to be a directory under the local folder.
96 the make_logfile_name() function (see below) can be used to create a
97 properly formed filename for logging. */
101 static basis::astring read_item(const basis::astring &key_name);
102 //!< returns the entry listed under the "key_name".
103 /*!< if the "key_name" is valid for the root configuration file, then this
104 should always return an appropriate value. a failure is denoted by return
105 of an empty string. */
107 static basis::astring make_logfile_name(const basis::astring &base_name);
108 //!< generates an installation appropriate log file name from "base_name".
109 /*!< creates and returns a full path name for a log file with the
110 "base_name" specified, using the LOGGING_FOLDER_NAME() entry as the
111 directory name. if the logging directory does not exist, it is created if
112 that is possible. the returned name is suitable for logging mechanisms that
113 need a filename. an empty string is returned on failure to create the
116 #if defined(__UNIX__) || defined(__GNU_WINDOWS__)
118 static basis::astring get_cmdline_for_apple();
120 static basis::astring get_cmdline_from_proc();
121 //!< retrieves the command line from the /proc hierarchy on linux.
122 static basis::astring query_for_process_info();
123 //!< seeks out process info for a particular process.