1 19 20 package org.netbeans.modules.java.platform.util; 21 22 23 public class FileNameUtil { 24 25 30 public static String computeAbsolutePath(String home, String relative) { 31 String path; 32 String separator = System.getProperty("file.separator"); 33 if (home.endsWith("\\") || home.endsWith("/")) home = home.substring(0, home.length() - 1); 35 if (relative.startsWith("\\") || relative.startsWith("/")) relative = relative.substring(1); 37 38 path = home + separator + relative; 39 if (separator.equals("/")) path = path.replace('\\', separator.charAt(0)); 41 else if (separator.equals("\\")) path = path.replace('/', separator.charAt(0)); 43 44 return path; 45 } 46 } 47 | Popular Tags |