1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Wed Oct 31 08:31:40 2012 -0700 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Wed Oct 31 13:48:15 2012 -0700 1.3 @@ -104,15 +104,12 @@ 1.4 return; 1.5 } 1.6 boolean nodeprecated = configuration.nodeprecated; 1.7 - String configdestdir = configuration.destDirName; 1.8 - String confighelpfile = configuration.helpfile; 1.9 - String configstylefile = configuration.stylesheetfile; 1.10 - performCopy(configdestdir, confighelpfile); 1.11 - performCopy(configdestdir, configstylefile); 1.12 - Util.copyResourceFile(configuration, "background.gif", false); 1.13 - Util.copyResourceFile(configuration, "tab.gif", false); 1.14 - Util.copyResourceFile(configuration, "titlebar.gif", false); 1.15 - Util.copyResourceFile(configuration, "titlebar_end.gif", false); 1.16 + performCopy(configuration.helpfile); 1.17 + performCopy(configuration.stylesheetfile); 1.18 + copyResourceFile("background.gif"); 1.19 + copyResourceFile("tab.gif"); 1.20 + copyResourceFile("titlebar.gif"); 1.21 + copyResourceFile("titlebar_end.gif"); 1.22 // do early to reduce memory footprint 1.23 if (configuration.classuse) { 1.24 ClassUseWriter.generate(configuration, classtree); 1.25 @@ -149,8 +146,8 @@ 1.26 // If a stylesheet file is not specified, copy the default stylesheet 1.27 // and replace newline with platform-specific newline. 1.28 if (configuration.stylesheetfile.length() == 0) { 1.29 - Util.copyFile(configuration, "stylesheet.css", DocPaths.RESOURCES, 1.30 - DocPath.empty, false, true); 1.31 + DocFile f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET); 1.32 + f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), false, true); 1.33 } 1.34 } 1.35 1.36 @@ -251,29 +248,33 @@ 1.37 return (ConfigurationImpl.getInstance()).validOptions(options, reporter); 1.38 } 1.39 1.40 - private void performCopy(String configdestdir, String filename) { 1.41 + /** 1.42 + * Copy a file in the resources directory to the destination directory. 1.43 + * @param resource The name of the resource file to copy 1.44 + */ 1.45 + private void copyResourceFile(String resource) { 1.46 + DocPath p = DocPaths.RESOURCES.resolve(resource); 1.47 + DocFile f = DocFile.createFileForOutput(configuration, p); 1.48 + f.copyResource(p, false, false); 1.49 + } 1.50 + 1.51 + private void performCopy(String filename) { 1.52 + if (filename.isEmpty()) 1.53 + return; 1.54 + 1.55 try { 1.56 - String destdir = (configdestdir.length() > 0) ? 1.57 - configdestdir + File.separatorChar: ""; 1.58 - if (filename.length() > 0) { 1.59 - File helpstylefile = new File(filename); 1.60 - String parent = helpstylefile.getParent(); 1.61 - String helpstylefilename = (parent == null)? 1.62 - filename: 1.63 - filename.substring(parent.length() + 1); 1.64 - File desthelpfile = new File(destdir + helpstylefilename); 1.65 - if (!desthelpfile.getCanonicalPath().equals( 1.66 - helpstylefile.getCanonicalPath())) { 1.67 - configuration.message. 1.68 - notice((SourcePosition) null, 1.69 - "doclet.Copying_File_0_To_File_1", 1.70 - helpstylefile.toString(), desthelpfile.toString()); 1.71 - Util.copyFile(desthelpfile, helpstylefile); 1.72 - } 1.73 - } 1.74 + DocFile fromfile = DocFile.createFileForInput(configuration, filename); 1.75 + DocPath path = DocPath.create(fromfile.getName()); 1.76 + DocFile toFile = DocFile.createFileForOutput(configuration, path); 1.77 + if (toFile.isSameFile(fromfile)) 1.78 + return; 1.79 + 1.80 + configuration.message.notice((SourcePosition) null, 1.81 + "doclet.Copying_File_0_To_File_1", 1.82 + fromfile.toString(), path.getPath()); 1.83 + toFile.copyFile(fromfile); 1.84 } catch (IOException exc) { 1.85 - configuration.message. 1.86 - error((SourcePosition) null, 1.87 + configuration.message.error((SourcePosition) null, 1.88 "doclet.perform_copy_exception_encountered", 1.89 exc.toString()); 1.90 throw new DocletAbortException();