1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java Wed Oct 17 16:43:26 2012 +0100 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java Tue Oct 23 13:20:37 2012 -0700 1.3 @@ -62,7 +62,7 @@ 1.4 * Relative path from the documentation root to the file that is being 1.5 * generated. 1.6 */ 1.7 - private static String relativePath = ""; 1.8 + private static DocPath relativePath = DocPath.empty; 1.9 1.10 /** 1.11 * Source is converted to HTML using static methods below. 1.12 @@ -77,7 +77,7 @@ 1.13 * @param outputdir the name of the directory to output to. 1.14 */ 1.15 public static void convertRoot(ConfigurationImpl configuration, RootDoc rd, 1.16 - String outputdir) { 1.17 + DocPath outputdir) { 1.18 if (rd == null || outputdir == null) { 1.19 return; 1.20 } 1.21 @@ -108,11 +108,11 @@ 1.22 * @param outputdir the name of the directory to output to. 1.23 */ 1.24 public static void convertPackage(ConfigurationImpl configuration, PackageDoc pd, 1.25 - String outputdir) { 1.26 + DocPath outputdir) { 1.27 if (pd == null || outputdir == null) { 1.28 return; 1.29 } 1.30 - String classOutputdir = getPackageOutputDir(outputdir, pd); 1.31 + DocPath classOutputdir = getPackageOutputDir(outputdir, pd); 1.32 ClassDoc[] cds = pd.allClasses(); 1.33 for (int i = 0; i < cds.length; i++) { 1.34 // If -nodeprecated option is set and the class is marked as deprecated, 1.35 @@ -131,9 +131,8 @@ 1.36 * @param pd the Package to generate output for. 1.37 * @return the package output directory as a String. 1.38 */ 1.39 - private static String getPackageOutputDir(String outputDir, PackageDoc pd) { 1.40 - return outputDir + File.separator + 1.41 - DirectoryManager.getDirectoryPath(pd) + File.separator; 1.42 + private static DocPath getPackageOutputDir(DocPath outputDir, PackageDoc pd) { 1.43 + return outputDir.resolve(DocPath.forPackage(pd)); 1.44 } 1.45 1.46 /** 1.47 @@ -144,7 +143,7 @@ 1.48 * @param outputdir the name of the directory to output to. 1.49 */ 1.50 public static void convertClass(ConfigurationImpl configuration, ClassDoc cd, 1.51 - String outputdir) { 1.52 + DocPath outputdir) { 1.53 if (cd == null || outputdir == null) { 1.54 return; 1.55 } 1.56 @@ -168,8 +167,9 @@ 1.57 LineNumberReader reader = new LineNumberReader(r); 1.58 int lineno = 1; 1.59 String line; 1.60 - relativePath = DirectoryManager.getRelativePath(DocletConstants.SOURCE_OUTPUT_DIR_NAME) + 1.61 - DirectoryManager.getRelativePath(cd.containingPackage()); 1.62 + relativePath = DocPaths.SOURCE_OUTPUT 1.63 + .resolve(DocPath.forPackage(cd)) 1.64 + .invert(); 1.65 Content body = getHeader(); 1.66 Content pre = new HtmlTree(HtmlTag.PRE); 1.67 try { 1.68 @@ -198,7 +198,7 @@ 1.69 * @param className the name of the class that I am converting to HTML. 1.70 * @param configuration the Doclet configuration to pass notices to. 1.71 */ 1.72 - private static void writeToFile(Content body, String outputDir, 1.73 + private static void writeToFile(Content body, DocPath outputDir, 1.74 String className, ConfigurationImpl configuration) throws IOException { 1.75 Content htmlDocType = DocType.Transitional(); 1.76 Content head = new HtmlTree(HtmlTag.HEAD); 1.77 @@ -208,7 +208,7 @@ 1.78 Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), 1.79 head, body); 1.80 Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree); 1.81 - File dir = new File(outputDir); 1.82 + File dir = outputDir.resolveAgainst(configuration.destDirName); 1.83 dir.mkdirs(); 1.84 File newFile = new File(dir, className + ".html"); 1.85 configuration.message.notice("doclet.Generating_0", newFile.getPath()); 1.86 @@ -227,17 +227,14 @@ 1.87 */ 1.88 public static HtmlTree getStyleSheetProperties(ConfigurationImpl configuration) { 1.89 String filename = configuration.stylesheetfile; 1.90 + DocPath stylesheet; 1.91 if (filename.length() > 0) { 1.92 - File stylefile = new File(filename); 1.93 - String parent = stylefile.getParent(); 1.94 - filename = (parent == null)? 1.95 - filename: 1.96 - filename.substring(parent.length() + 1); 1.97 + stylesheet = DocPath.create(new File(filename).getName()); 1.98 } else { 1.99 - filename = "stylesheet.css"; 1.100 + stylesheet = DocPaths.STYLESHEET; 1.101 } 1.102 - filename = relativePath + filename; 1.103 - HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", filename, "Style"); 1.104 + DocPath p = relativePath.resolve(stylesheet); 1.105 + HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", p.getPath(), "Style"); 1.106 return link; 1.107 } 1.108