Add utility used in EpocEnginHelper
authorEd Swartz <ed.swartz@nokia.com>
Wed, 09 Dec 2009 09:01:15 -0600
changeset 658 fb206b3e6dda
parent 657 7f614450f806
child 659 19b66faa8ff1
Add utility used in EpocEnginHelper
core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/HostOS.java
--- a/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/HostOS.java	Wed Dec 09 09:00:20 2009 -0600
+++ b/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/HostOS.java	Wed Dec 09 09:01:15 2009 -0600
@@ -96,8 +96,23 @@
 	}
 
 	/**
+	 * Convert a path which may be in the opposite slash format to the local slash format.
+	 * NOTE: we assume that the path is already a legal path, 
+	 * but just with the wrong slash.
+	 * @param file
+	 * @return converted string
+	 */
+	public static String convertPathToNative(String path) {
+		if (path == null) return null;
+		if (IS_UNIX)
+			return path.replaceAll("\\\\", "/");
+		else
+			return path.replaceAll("/", "\\\\");
+	}
+
+	/**
 	 * Create an IPath from a string which may be a Win32 path. <p>
-	 * (This won't work in Unix when using a Win32 path.)
+	 * ("new Path(...)" won't work in Unix when using a Win32 path.)
 	 * @param path
 	 * @return converted string
 	 */