# HG changeset patch # User Ed Swartz # Date 1259956431 21600 # Node ID 675796977d5c0b49efa39c3f790063d02d1c1607 # Parent dee2f67c6538d8b2629460fa40b884176c08d858 Add utility to create IPath from a possibly Win32 string (since this won't parse properly in Unix) diff -r dee2f67c6538 -r 675796977d5c 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 Fri Dec 04 08:33:28 2009 -0600 +++ b/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/HostOS.java Fri Dec 04 13:53:51 2009 -0600 @@ -35,7 +35,7 @@ /** The name of the PATH variable in the environment. Capitalized differently per OS. */ public static String PATH_VARIABLE_NAME = IS_WIN32 ? "Path" : "PATH"; - + /** * Convert a variable constructed blindly for a Win32 environment into * Unix-like syntax. This is typically used for PATH or lists @@ -96,6 +96,21 @@ } /** + * Create an IPath from a string which may be a Win32 path.

+ * (This won't work in Unix when using a Win32 path.) + * @param path + * @return converted string + */ + public static IPath createPathFromString(String path) { + if (path == null) return null; + // handle Windows slashes and canonicalize + path = path.replaceAll("\\\\", "/"); + return new Path(path); + } + + + + /** * Ensure that the executable name mentioned is canonical for the machine. * This only affects Windows, currently, ensuring that an ".exe" is attached. * @param executablePath @@ -158,6 +173,4 @@ return path; } - - }