rtemstoolkit: Add support to return the system path split as paths.

Seacch the path for the program name if not found and set it as
an absolute path. This allow the prefix to be found.
This commit is contained in:
Chris Johns
2015-03-29 18:06:00 +11:00
parent 5032d71ab6
commit b24951645d
4 changed files with 45 additions and 3 deletions

View File

@@ -235,7 +235,25 @@ namespace rld
void
set_progname (const std::string& progname_)
{
progname = rld::path::path_abs (progname_);
if (rld::path::check_file (progname_))
progname = rld::path::path_abs (progname_);
else
{
rld::path::paths paths;
rld::path::get_system_path (paths);
for (rld::path::paths::const_iterator path = paths.begin ();
path != paths.end ();
++path)
{
std::string pp;
rld::path::path_join (*path, progname_, pp);
if (rld::path::check_file (pp))
{
progname = rld::path::path_abs (pp);
break;
}
}
}
}
const std::string
@@ -262,7 +280,7 @@ namespace rld
std::string pp = get_program_path ();
if (rld::path::basename (pp) == "bin")
return rld::path::dirname (pp);
return "";
return pp;
}
void