mirror of
https://git.rtems.org/rtems-tools/
synced 2025-10-17 23:34:29 +08:00
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:
@@ -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
|
||||
|
Reference in New Issue
Block a user