18#define HELP_MESSAGE "\
20 yarpmanager [option]\n\n\
22 --load_application Path to application to load in the main window\n\
23 --from Configuration file name\n\
24 --application Path to application to open\n\
33 --connection_failure \n\
36 --add_current_dir add the current dir to the search path\n\
37 --elapsed_time if present the time stamp for log messages will be relative to the GUI start time\n\
38 --disable_autoreload if present it will disable applications autoreload on loaded files modifications\n\
41#define DEF_CONFIG_FILE "ymanager.ini"
57int main(
int argc,
char *argv[])
67 HWND hwnd = GetConsoleWindow();
68 HWND hide = FindWindowA(
"ConsoleWindowClass",NULL);
71 QApplication a(argc, argv);
85 if(config.
check(
"help"))
94 bool add_curr_dir =
false;
95 if(config.
check(
"add_current_dir"))
99 const int cur_dir_max_size=512;
100 char current_dir[cur_dir_max_size]; current_dir[0]=0;
102 config.
put(
"current_dir", current_dir);
104 std::string inifile=rf.
findFile(
"from");
106 size_t lastSlash=inifile.rfind(
'/');
107 if (lastSlash!=std::string::npos){
108 inipath=inifile.substr(0, lastSlash+1);
110 lastSlash=inifile.rfind(
'\\');
111 if (lastSlash!=std::string::npos){
112 inipath=inifile.substr(0, lastSlash+1);
116 if(!config.
check(
"ymanagerini_dir")){
117 config.
put(
"ymanagerini_dir", inipath);
121 if(!config.
check(
"apppath")){
130 QString appPathsStr=
"";
131 for (
size_t ind=0; ind < appPaths.
size(); ++ind){
132 appPathsStr += (appPaths.
get(ind).
asString() +
";").c_str();
134 for (
size_t ind=0; ind < appPaths2.
size(); ++ind){
135 appPathsStr += (appPaths2.
get(ind).
asString() +
";").c_str();
139 appPathsStr += (current_dir + std::string(
";")).c_str();
141 std::string sss= appPathsStr.toLatin1().data();
142 config.
put(
"apppath", appPathsStr.toLatin1().data());
145 if(!config.
check(
"modpath")){
148 QString modPathsStr=
"";
149 for (
size_t ind=0; ind < appPaths.
size(); ++ind){
150 modPathsStr += (appPaths.
get(ind).
asString() +
";").c_str();
154 modPathsStr += (current_dir + std::string(
";")).c_str();
156 config.
put(
"modpath", modPathsStr.toLatin1().data());
159 if(!config.
check(
"respath")){
162 QString resPathsStr=
"";
163 for (
size_t ind=0; ind < appPaths.
size(); ++ind){
164 resPathsStr += (appPaths.
get(ind).
asString() +
";").c_str();
168 resPathsStr += (current_dir + std::string(
";")).c_str();
170 config.
put(
"respath", resPathsStr.toLatin1().data());
173 if(!config.
check(
"templpath")){
174 appPaths=rf.
findPaths(
"templates/applications");
176 QString templPathsStr=
"";
177 for (
size_t ind=0; ind < appPaths.
size(); ++ind){
178 templPathsStr += (appPaths.
get(ind).
asString() +
";").c_str();
182 templPathsStr += (current_dir + std::string(
";")).c_str();
184 config.
put(
"templpath", templPathsStr.toLatin1().data());
188 if(!config.
check(
"load_subfolders")){
189 config.
put(
"load_subfolders",
"yes");
192 if(!config.
check(
"watchdog")){
193 config.
put(
"watchdog",
"no");
196 if(!config.
check(
"module_failure")){
197 config.
put(
"module_failure",
"prompt");
200 if(!config.
check(
"connection_failure")){
201 config.
put(
"connection_failure",
"prompt");
204 if(!config.
check(
"auto_connect")){
205 config.
put(
"auto_connect",
"no");
208 if(!config.
check(
"auto_dependency")){
209 config.
put(
"auto_dependency",
"no");
212 if(!config.
check(
"elapsed_time"))
void init(yarp::os::Property config)
Init the application with the current configuration.
Singleton class For storing execution start time.
void setStartTime(std::string startTimeStr)
Set the starting time from a string in HH:MM:SS format.
static ClockStart & getInstance()
A simple collection of objects that can be described and transmitted in a portable way.
size_type size() const
Gets the number of elements in the bottle.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Utilities for manipulating the YARP network, including initialization and shutdown.
A class for storing options and configuration information.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
These options are loosely based on http://wiki.icub.org/wiki/YARP_ResourceFinder.
SearchLocations searchLocations
Helper class for finding config files and other external resources.
bool setDefaultContext(const std::string &contextName)
Sets the context for the current ResourceFinder object.
bool configure(int argc, char *argv[], bool skipFirstArgument=true)
Sets up the ResourceFinder.
std::string toString() const override
Return a standard text representation of the content of the object.
static ResourceFinder & getResourceFinderSingleton()
Access a ResourceFinder singleton whose lifetime will match that of the YARP library.
yarp::os::Bottle findPaths(const std::string &name)
Expand a partial path to a list of paths.
std::string findFile(const std::string &name)
Find the full path to a file.
bool setDefaultConfigFile(const std::string &fname)
Provide a default value for the configuration file (can be overridden from command line with the –fro...
virtual std::string asString() const
Get string value.
int main(int argc, char *argv[])
void onSignal(int signum)
char * getcwd(char *buf, size_t size)
Portable wrapper for the getcwd() function.
The main, catch-all namespace for YARP.