Add utility to create IPath from a possibly Win32 string (since this won't parse properly in Unix)
--- 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. <p>
+ * (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;
}
-
-
}