Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
basic-setup.cpp
Go to the documentation of this file.
1/*
2 BasicSetup - elementary self-configuration of the application
3
4 Copyright (C)
5 2011, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
14
28#include "lib/searchpath.hpp"
29#include "lib/error.hpp"
30#include "lib/file.hpp"
31#include "lib/util.hpp"
32
33extern "C" {
34#include <unistd.h>
35}
36#include <fstream>
37
38
39namespace lumiera {
40
41 using std::string;
42 using std::ifstream;
43
44 namespace opt = boost::program_options;
45
46 namespace { // details of the bootstrap process...
47
48
49 // Helper to locate a module using a search path spec
51
54 string
55 resolve (fs::path iniSpec)
56 {
57 string searchpath = iniSpec.parent_path().generic_string();
58 return resolveModulePath (iniSpec.filename(), searchpath);
59 }
60
61 }//(End) implementation details
62
63
64
72 BasicSetup::BasicSetup (string bootstrapIni)
73 : syntax("Lumiera installation and platform configuration")
74 , settings()
75 {
76 syntax.add_options()
77 ("Lumiera.gui", opt::value<string>(),
78 "name of the Lumiera GUI plugin to load")
79 ("Lumiera.modulepath", opt::value<string>(),
80 "search path for loadable modules. "
81 "May use $ORIGIN to refer to the EXE location")
82 ("Lumiera.configpath", opt::value<string>(),
83 "search path for extended configuration. "
84 "Extended Config system not yet implemented "
85 "Ignored as of 2/2011")
86 ("Lumiera.title", opt::value<string>(),
87 "title of the Lumiera Application, e.g. for windows")
88 ("Lumiera.version", opt::value<string>(),
89 "Application version string")
90 ("Lumiera.website", opt::value<string>(),
91 "URL of the Lumiera website")
92 ("Lumiera.authors", opt::value<string>(),
93 "names of Lumiera authors, for 'about' dialog. Separated by '|'")
94 ("Lumiera.copyright", opt::value<string>(),
95 "year(s) for the author's copyright claim")
96
97 ("Gui.stylesheet", opt::value<string>(),
98 "name of the GTK stylesheet to use. Will be searched in resource path")
99 ("Gui.iconpath", opt::value<string>(),
100 "search path for icons")
101 ("Gui.resourcepath", opt::value<string>(),
102 "general search path for UI resources")
103 ;
104
105 ifstream configIn (resolve(bootstrapIni).c_str());
106
107
108 opt::parsed_options parsed = opt::parse_config_file (configIn, syntax);
109
110 opt::store (parsed, settings);
111 opt::notify(settings);
112 }
113
114
115
116} // namespace lumiera
Bootstrap and self-configuration of the application at startup.
opt::options_description syntax
opt::variables_map settings
BasicSetup(string bootstrapIni)
Creating the BasicSetup object performs the initial self-configuration of the Lumiera Application.
Lumiera error handling (C++ interface).
Includes the C++ Filesystem library and provides some convenience helpers.
string resolveModulePath(fs::path moduleName, string searchPath)
helper to establish the location to search for loadable modules, configuration files,...
string resolve(fs::path iniSpec)
use the general mechanism for resolving a search path to get the absolute path of the setup....
Lumiera public interface.
Definition advice.hpp:102
Helpers to handle directory search paths.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...