Changeset 504 in josm for trunk/src/org/openstreetmap/josm/plugins
- Timestamp:
- 2007-12-31T17:49:15+01:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java
r298 r504 9 9 import java.io.InputStream; 10 10 import java.net.URL; 11 import java.net.MalformedURLException; 11 12 import java.util.ArrayList; 12 13 import java.util.Collection; … … 84 85 String classPath = attr.getValue(Attributes.Name.CLASS_PATH); 85 86 if (classPath != null) { 86 String[] cp = classPath.split(" "); 87 StringBuilder entry = new StringBuilder(); 88 for (String s : cp) { 89 entry.append(s); 90 if (s.endsWith("\\")) { 91 entry.setLength(entry.length()-1); 92 entry.append("%20"); // append the split character " " as html-encode 93 continue; 87 for (String entry : classPath.split(" ")) { 88 File entryFile; 89 if (new File(entry).isAbsolute()) { 90 entryFile = new File(entry); 91 } else { 92 entryFile = new File(file.getParent(), entry); 94 93 } 95 s = entry.toString(); 96 entry = new StringBuilder(); 97 if (!s.startsWith("/") && !s.startsWith("\\") && !s.matches("^.\\:") && file != null) 98 s = file.getParent() + File.separator + s; 99 libraries.add(new URL(getURLString(s))); 94 95 libraries.add(fileToURL(entryFile)); 100 96 } 101 97 } … … 112 108 } 113 109 if (file != null) 114 libraries.add(0, new URL(getURLString(file.getAbsolutePath())));110 libraries.add(0, fileToURL(file)); 115 111 116 112 if (jar != null) … … 147 143 } 148 144 149 public static String getURLString(String fileName) { 150 if (System.getProperty("os.name").startsWith("Windows")) 151 return "file:/"+fileName; 152 return "file://"+fileName; 145 public static URL fileToURL(File f) { 146 try { 147 return f.toURI().toURL(); 148 } catch (MalformedURLException ex) { 149 return null; 150 } 153 151 } 154 152
Note:
See TracChangeset
for help on using the changeset viewer.