summaryrefslogtreecommitdiff
path: root/rld-path.cpp
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2014-09-05 18:16:40 +1000
committerChris Johns <chrisj@rtems.org>2014-09-05 18:16:40 +1000
commit5679661069a8b9acaec26d61c8da797f0726506b (patch)
treeb3a8af2246ebbdfdd988a41a7c9658b374d0f165 /rld-path.cpp
parent566f389fb9f7f2b124e6055947c9edc8820107b6 (diff)
Add support for RTEMS BSP or user supplied CFLAGS. Remove march/mcpu.
Added support to read an RTEMS BSP pkgconfig file and ste the CC flags.
Diffstat (limited to 'rld-path.cpp')
-rw-r--r--rld-path.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/rld-path.cpp b/rld-path.cpp
index 50eb992..51288ce 100644
--- a/rld-path.cpp
+++ b/rld-path.cpp
@@ -18,14 +18,7 @@
#include "config.h"
#endif
-#include <algorithm>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
#include <sys/stat.h>
-#include <unistd.h>
#include <rld.h>
@@ -78,16 +71,27 @@ namespace rld
}
void
- path_join (const std::string& path_, const std::string& file_, std::string& joined)
+ path_join (const std::string& base, const std::string& part, std::string& joined)
{
- if ((path_[path_.size () - 1] != RLD_PATH_SEPARATOR) &&
- (file_[0] != RLD_PATH_SEPARATOR))
- joined = path_ + RLD_PATH_SEPARATOR + file_;
- else if ((path_[path_.size () - 1] == RLD_PATH_SEPARATOR) &&
- (file_[0] == RLD_PATH_SEPARATOR))
- joined = path_ + &file_[1];
+ if ((base[base.size () - 1] != RLD_PATH_SEPARATOR) &&
+ (part[0] != RLD_PATH_SEPARATOR))
+ joined = base + RLD_PATH_SEPARATOR + part;
+ else if ((base[base.size () - 1] == RLD_PATH_SEPARATOR) &&
+ (part[0] == RLD_PATH_SEPARATOR))
+ joined = base + &part[1];
else
- joined = path_ + file_;
+ joined = base + part;
+ }
+
+ void path_join (const std::string& base, const paths& parts, std::string& joined)
+ {
+ joined = base;
+ for (paths::const_iterator pi = parts.begin ();
+ pi != parts.end ();
+ ++pi)
+ {
+ path_join (joined, *pi, joined);
+ }
}
bool