summaryrefslogtreecommitdiffstats
path: root/rtemstoolkit/rld-path.cpp
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2015-03-29 18:06:00 +1100
committerChris Johns <chrisj@rtems.org>2015-03-29 18:06:00 +1100
commitb24951645db3105213ab3f9ce6ae52c84425a4fa (patch)
tree6fb77c4c7f994b5688ad95cf406a068f805222a1 /rtemstoolkit/rld-path.cpp
parenttrace-linker: Update comments. (diff)
downloadrtems-tools-b24951645db3105213ab3f9ce6ae52c84425a4fa.tar.bz2
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.
Diffstat (limited to 'rtemstoolkit/rld-path.cpp')
-rw-r--r--rtemstoolkit/rld-path.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/rtemstoolkit/rld-path.cpp b/rtemstoolkit/rld-path.cpp
index 333c1c2..c848676 100644
--- a/rtemstoolkit/rld-path.cpp
+++ b/rtemstoolkit/rld-path.cpp
@@ -214,5 +214,23 @@ namespace rld
throw rld::error ("Not found", "unlinking: " + path);
}
}
+
+ void
+ get_system_path (paths& paths)
+ {
+ const char* path = ::getenv ("PATH");
+ strings ps;
+ rld::split (ps, path, RLD_PATHSTR_SEPARATOR);
+ if (ps.size ())
+ {
+ for (strings::iterator psi = ps.begin ();
+ psi != ps.end ();
+ ++psi)
+ {
+ if (check_directory (*psi))
+ paths.push_back (*psi);
+ }
+ }
+ }
}
}