Example usage for org.aspectj.apache.bcel.util ClassPath getPath

List of usage examples for org.aspectj.apache.bcel.util ClassPath getPath

Introduction

In this page you can find the example usage for org.aspectj.apache.bcel.util ClassPath getPath.

Prototype

public String getPath(String name) throws IOException 

Source Link

Usage

From source file:br.jabuti.project.ClassSourceFile.java

License:Open Source License

private String findLocalSourceFileName(String sourceName) {
    //System.out.println("THE SOURCE NAME: " + sourceName);

    ClassPath cp = null;

    if (prj != null) { // If the project is activated, include additional paths
        cp = new ClassPath(System.getProperty("java.class.path") + File.pathSeparator + prj.getClasspath());
    } else {//w  ww.ja  v  a 2s . co  m
        cp = new ClassPath(System.getProperty("java.class.path"));
    }

    String sourcePath = null;

    try {
        /*StringTokenizer st = new StringTokenizer( System.getProperty("java.class.path"),
           File.pathSeparator );
         while (st.hasMoreTokens()) {
            System.out.println(st.nextToken());
        }*/

        sourcePath = cp.getPath(sourceName);
    } catch (IOException io) {
        return null;
    }

    File file = new File(sourcePath);
    if (file.exists()) {
        //System.out.println( "SOURCE FOUND AT: " + sourcePath );
        return sourcePath;
    } else { // Source not found
        return null;
    }
}