Java Code Examples for com.android.io.FileWrapper#isFile()

The following examples show how to use com.android.io.FileWrapper#isFile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProjectCreator.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Checks whether the give <var>folderPath</var> is a valid project folder, and returns
 * a {@link FileWrapper} to the required file.
 * <p/>This checks that the folder exists and contains an AndroidManifest.xml file in it.
 * <p/>Any error are output using {@link #mLog}.
 * @param folderPath the folder to check
 * @param requiredFilename the file name of the file that's required.
 * @return a {@link FileWrapper} to the AndroidManifest.xml file, or null otherwise.
 */
private FileWrapper checkProjectFolder(String folderPath, String requiredFilename) {
    // project folder must exist and be a directory, since this is an update
    FolderWrapper projectFolder = new FolderWrapper(folderPath);
    if (!projectFolder.isDirectory()) {
        mLog.error(null, "Project folder '%1$s' is not a valid directory.",
                projectFolder);
        return null;
    }

    // Check AndroidManifest.xml is present
    FileWrapper requireFile = new FileWrapper(projectFolder, requiredFilename);
    if (!requireFile.isFile()) {
        mLog.error(null,
                "%1$s is not a valid project (%2$s not found).",
                folderPath, requiredFilename);
        return null;
    }

    return requireFile;
}
 
Example 2
Source File: ProjectCreator.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Checks whether the give <var>folderPath</var> is a valid project folder, and returns
 * a {@link FileWrapper} to the required file.
 * <p/>This checks that the folder exists and contains an AndroidManifest.xml file in it.
 * <p/>Any error are output using {@link #mLog}.
 * @param folderPath the folder to check
 * @param requiredFilename the file name of the file that's required.
 * @return a {@link FileWrapper} to the AndroidManifest.xml file, or null otherwise.
 */
private FileWrapper checkProjectFolder(String folderPath, String requiredFilename) {
    // project folder must exist and be a directory, since this is an update
    FolderWrapper projectFolder = new FolderWrapper(folderPath);
    if (!projectFolder.isDirectory()) {
        mLog.error(null, "Project folder '%1$s' is not a valid directory.",
                projectFolder);
        return null;
    }

    // Check AndroidManifest.xml is present
    FileWrapper requireFile = new FileWrapper(projectFolder, requiredFilename);
    if (!requireFile.isFile()) {
        mLog.error(null,
                "%1$s is not a valid project (%2$s not found).",
                folderPath, requiredFilename);
        return null;
    }

    return requireFile;
}