home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Main.bin
/
BatchJavaDoc.java
< prev
next >
Wrap
Text File
|
1998-09-08
|
3KB
|
96 lines
package com.symantec.itools.tools.utilities;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import com.symantec.itools.io.Directory;
import com.symantec.itools.io.FileSystem;
import com.symantec.itools.io.NotDirectoryException;
import com.symantec.itools.io.WildCardFileFilenameFilter;
/**
* @author Symantec Internet Tools Division
* @version 1.0
* @since VCafe 3.0
*/
public class BatchJavaDoc
{
/**
* @param argv TODO
* @since VCafe 3.0
*/
public static void main(String[] argv)
{
String baseDir;
int index;
String[] dirs;
StringBuffer list;
baseDir = FileSystem.getCanonicalPath(argv[0], true);
index = baseDir.length();
list = new StringBuffer();
try
{
dirs = new Directory(argv[0]).listDirectories(true);
for(int i = 0; i < dirs.length; i++)
{
String pkg;
pkg = dirs[i].substring(index).replace('\\', '.');
if((pkg != null) && !(pkg.equals("")))
{
Directory currentDir;
currentDir = new Directory(dirs[i]);
// any .java files in this dir?
if(currentDir.listFiles(
new WildCardFileFilenameFilter("*.java", false), false).length > 0)
{
list.append(pkg);
list.append(' ');
}
}
}
}
catch(NotDirectoryException ex)
{
System.err.println(argv[0] + " is not a directory");
System.exit(1);
}
catch(FileNotFoundException ex)
{
System.err.println(argv[0] + " does not exist");
System.exit(2);
}
catch(IOException ex)
{
System.err.println("Error processing " + argv[0]);
System.exit(3);
}
try
{
FileWriter writer;
PrintWriter printer;
writer = new FileWriter(argv[1]);
printer = new PrintWriter(writer);
printer.println(list);
printer.flush();
printer.close();
}
catch(IOException ex)
{
System.err.println("Error writing " + argv[1]);
System.exit(4);
}
}
}