diff -r 1f0034e370aa -r 71ad690e91f5 javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/CLDCCompatibilityDelegate.java --- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/CLDCCompatibilityDelegate.java Fri Sep 17 16:44:34 2010 +0300 +++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/CLDCCompatibilityDelegate.java Mon Oct 04 11:29:25 2010 +0300 @@ -42,24 +42,34 @@ return inputStream; } - public String convertPathToSpecific(String path) { - String jsr75Path = path; - if (!jsr75Path.startsWith("file:///")) { - // In JSR 75 the file separator is '/' and not '\' - jsr75Path = jsr75Path.replace('\\', '/'); - jsr75Path = "file:///" + jsr75Path; + public String convertPathToSpecific(String path) { + String res = path; + + // In JSR 75 the file separator is '/' and not '\' + res = res.replace('\\', '/'); + + if (res.startsWith("file:///")) { + res = res.substring(8); } - return jsr75Path; - } + boolean hasDrive = false; + if (res.length() >= 2) { + char drive = res.charAt(0); + hasDrive = ((drive >= 'A' && drive <= 'Z') || (drive >= 'a' && drive <= 'z')) + && (res.charAt(1) == ':'); + } - public String convertPathFromSpecific(String jsr75Path) { - String stdPath = jsr75Path; - if (jsr75Path.startsWith("file:///")) { - stdPath = stdPath.replace('/', '\\'); - stdPath = stdPath.substring(8, stdPath.length()).replace('/', '\\');; + if (!hasDrive) { + res = System.getProperty("fileconn.dir.private") + res; // may start now as file:/// } - return stdPath; + + if (!res.startsWith("file:///")) { + res = "file:///" + res; + } + + // The format now should be: file:///:/ + + return res; } public boolean canOpenFile(String path) throws SecurityException {