From 91c2b84a92a7cff0bbfc253e8937dd4832690bf7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 8 Mar 2007 11:49:26 -0500 Subject: ENH: Added ConvertToOutputSlashes method to convert slashes with the same policy as ConvertToOutputPath but without escaping. --- Source/cmSystemTools.cxx | 17 +++++++++++++++++ Source/cmSystemTools.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 7af78fb..530d7fd 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1341,6 +1341,23 @@ std::string cmSystemTools::ConvertToOutputPath(const char* path) #endif } +void cmSystemTools::ConvertToOutputSlashes(std::string& path) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + if(!s_ForceUnixPaths) + { + // Convert to windows slashes. + std::string::size_type pos = 0; + while((pos = path.find('/', pos)) != std::string::npos) + { + path[pos++] = '\\'; + } + } +#else + static_cast(path); +#endif +} + std::string cmSystemTools::ConvertToRunCommandPath(const char* path) { #if defined(_WIN32) && !defined(__CYGWIN__) diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index ecb595d..1838039 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -289,6 +289,8 @@ public: // ConvertToOutputPath use s_ForceUnixPaths static std::string ConvertToOutputPath(const char* path); + static void ConvertToOutputSlashes(std::string& path); + // ConvertToRunCommandPath does not use s_ForceUnixPaths and should // be used when RunCommand is called from cmake, because the // running cmake needs paths to be in its format -- cgit v0.12