summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemTools.hxx.in
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-01-11 13:33:48 (GMT)
committerBrad King <brad.king@kitware.com>2008-01-11 13:33:48 (GMT)
commita6d32b96ed3e6fec59d84e33eb08e7bf6642ffe9 (patch)
tree7994bec071a8f285182afabfcec9aa1379f2e851 /Source/kwsys/SystemTools.hxx.in
parentd7c7ab0927fe944323114ce516433493572b9c4d (diff)
downloadCMake-a6d32b96ed3e6fec59d84e33eb08e7bf6642ffe9.zip
CMake-a6d32b96ed3e6fec59d84e33eb08e7bf6642ffe9.tar.gz
CMake-a6d32b96ed3e6fec59d84e33eb08e7bf6642ffe9.tar.bz2
ENH: Add SystemTools::SplitPathRootComponent and re-implement SplitPath to use it. Add better treatment of user home directory paths.
Diffstat (limited to 'Source/kwsys/SystemTools.hxx.in')
-rw-r--r--Source/kwsys/SystemTools.hxx.in26
1 files changed, 21 insertions, 5 deletions
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 4845851..fa8c7ad 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -351,20 +351,36 @@ public:
const char* in_base);
/**
- * Split a path name into its basic components. The first component
- * is one of the following roots:
- * "/" = UNIX
+ * Split a path name into its root component and the rest of the
+ * path. The root component is one of the following:
+ * "/" = UNIX full path
* "c:/" = Windows full path (can be any drive letter)
* "c:" = Windows drive-letter relative path (can be any drive letter)
* "//" = Network path
+ * "~" = Home path for current user
+ * "~u" = Home path for user 'u'
* "" = Relative path
+ *
+ * A pointer to the rest of the path after the root component is
+ * returned. The root component is stored in the "root" string if
+ * given.
+ */
+ static const char* SplitPathRootComponent(const char* p,
+ kwsys_stl::string* root=0);
+
+ /**
+ * Split a path name into its basic components. The first component
+ * is one of the roots returned by SplitPathRootComponent.
* The remaining components form the path. If there is a trailing
* slash then the last component is the empty string. The
* components can be recombined as "c[0]c[1]/c[2]/.../c[n]" to
- * produce the original path.
+ * produce the original path. Home directory references are
+ * automatically expanded if expand_home_dir is true and this
+ * platform supports them.
*/
static void SplitPath(const char* p,
- kwsys_stl::vector<kwsys_stl::string>& components);
+ kwsys_stl::vector<kwsys_stl::string>& components,
+ bool expand_home_dir = true);
/**
* Join components of a path name into a single string. See