Example #1
0
 /**
  * Given a PackageDoc, return the source path for that package.
  *
  * @param configuration The Configuration for the current Doclet.
  * @param pkgDoc The package to seach the path for.
  * @return A string representing the path to the given package.
  */
 public static String getPackageSourcePath(Configuration configuration, PackageDoc pkgDoc) {
   try {
     String pkgPath = DirectoryManager.getDirectoryPath(pkgDoc);
     String completePath =
         new SourcePath(configuration.sourcepath).getDirectory(pkgPath)
             + DirectoryManager.URL_FILE_SEPERATOR;
     // Make sure that both paths are using the same seperators.
     completePath =
         Util.replaceText(completePath, File.separator, DirectoryManager.URL_FILE_SEPERATOR);
     pkgPath = Util.replaceText(pkgPath, File.separator, DirectoryManager.URL_FILE_SEPERATOR);
     return completePath.substring(0, completePath.indexOf(pkgPath));
   } catch (Exception e) {
     return "";
   }
 }
 /** Copy the doc files for the current ClassDoc if necessary. */
 private void copyDocFiles() {
   PackageDoc containingPackage = annotationTypeDoc.containingPackage();
   if ((configuration.packages == null
           || Arrays.binarySearch(configuration.packages, containingPackage) < 0)
       && !containingPackagesSeen.contains(containingPackage.name())) {
     // Only copy doc files dir if the containing package is not
     // documented AND if we have not documented a class from the same
     // package already. Otherwise, we are making duplicate copies.
     Util.copyDocFiles(
         configuration,
         Util.getPackageSourcePath(configuration, annotationTypeDoc.containingPackage())
             + DirectoryManager.getDirectoryPath(annotationTypeDoc.containingPackage())
             + File.separator,
         DocletConstants.DOC_FILES_DIR_NAME,
         true);
     containingPackagesSeen.add(containingPackage.name());
   }
 }