summaryrefslogtreecommitdiff
path: root/Source/kwsys/SystemTools.hxx.in
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2006-02-07 10:23:17 -0500
committerAndy Cedilnik <andy.cedilnik@kitware.com>2006-02-07 10:23:17 -0500
commite5a8e115bc26e6a7f6b25dc2450e9bb28fca6fa1 (patch)
tree3066579e9fc9477dc9dce981446a6fb30db91f19 /Source/kwsys/SystemTools.hxx.in
parentf71a085f74e4b21f3b666c71557534b7603604dd (diff)
downloadcmake-e5a8e115bc26e6a7f6b25dc2450e9bb28fca6fa1.tar.gz
ENH: Move relative path to kwsys
Diffstat (limited to 'Source/kwsys/SystemTools.hxx.in')
-rw-r--r--Source/kwsys/SystemTools.hxx.in18
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 703f739957..31bfa9aeae 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -20,6 +20,7 @@
#include <@KWSYS_NAMESPACE@/stl/map>
#include <@KWSYS_NAMESPACE@/Configure.h>
+#include <@KWSYS_NAMESPACE@/String.hxx>
#include <sys/types.h>
@@ -176,6 +177,13 @@ public:
*/
static kwsys_stl::string CropString(const kwsys_stl::string&,size_t max_len);
+ /** split a path by separator into an array of strings, default is /.
+ If isPath is true then the string is treated like a path and if
+ s starts with a / then the first element of the returned array will
+ be /, so /foo/bar will be [/, foo, bar]
+ */
+ static std::vector<String> SplitString(const char* s, char separator = '/',
+ bool isPath = false);
/**
* Perform a case-independent string comparison
*/
@@ -574,6 +582,16 @@ public:
static kwsys_stl::string FileExistsInParentDirectories(const char* fname,
const char* directory, const char* toplevel);
+ /** compute the relative path from local to remote. local must
+ be a directory. remote can be a file or a directory.
+ Both remote and local must be full paths. Basically, if
+ you are in directory local and you want to access the file in remote
+ what is the relative path to do that. For example:
+ /a/b/c/d to /a/b/c1/d1 -> ../../c1/d1
+ from /usr/src to /usr/src/test/blah/foo.cpp -> test/blah/foo.cpp
+ */
+ static std::string RelativePath(const char* local, const char* remote);
+
/**
* Return file's modified time
*/