Transformador now takes a file/dir and transforms that
This commit is contained in:
parent
c768ffb7d3
commit
6be592fbd1
1 changed files with 20 additions and 2 deletions
|
@ -7,12 +7,30 @@ import com.github.javaparser.ast.comments.Comment;
|
|||
import com.github.javaparser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
public class Transformador {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
File file = new File(args[0]);
|
||||
if (file.isDirectory())
|
||||
analyzeDir(file);
|
||||
else
|
||||
analyzeFile(file);
|
||||
}
|
||||
|
||||
public static void analyzeDir(File dir) throws FileNotFoundException {
|
||||
for (File f : dir.listFiles()) {
|
||||
if (f.isDirectory())
|
||||
analyzeDir(f);
|
||||
else if (f.getName().endsWith(".java"))
|
||||
analyzeFile(f);
|
||||
}
|
||||
}
|
||||
|
||||
public static void analyzeFile(File file) throws FileNotFoundException {
|
||||
// Ruta del fichero con el programa que vamos a transformar
|
||||
String ruta = "./src/test/res/ejemplos/Test_1";
|
||||
String ruta = file.getPath().substring(0, file.getPath().lastIndexOf(".java"));
|
||||
|
||||
// Abrimos el fichero original (un ".java")
|
||||
File original = new File(ruta + ".java");
|
||||
|
|
Loading…
Reference in a new issue