Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.io.File;

import java.io.IOException;

import java.util.Vector;

public class Main {
    public static void getScripts(File project, Vector<String> scripts, String projectPath) throws IOException {
        if (project != null && project.isFile()) {
            String canonicalPath = project.getCanonicalPath();
            //System.out.println("bbbbbbbbbbb:" + canonicalPath + "  " + projectPath);
            int index = canonicalPath.indexOf(projectPath);//lastIndexOf(System.getProperty("file.separator") + "workspace" + System.getProperty("file.separator"));
            String relativePath = canonicalPath.substring(projectPath.length(), canonicalPath.length());
            //System.out.println("bbbbbbbbbbb:" + relativePath);
            //scripts.add(project.getCanonicalPath());
            scripts.add(relativePath);
        } else if (project != null && project.isDirectory()) {
            File[] files = project.listFiles();
            for (int i = 0; i < files.length; i++) {
                getScripts(files[i], scripts, projectPath);
            }
        }
    }
}