Java Path File Check nio isBallerinaProject(Path path)

Here you can find the source of isBallerinaProject(Path path)

Description

Is path is a valid ballerina project directory.

License

Open Source License

Parameter

Parameter Description
path path to suspecting dir

Return

if path is a ballerina project directory or not

Declaration

public static boolean isBallerinaProject(Path path) 

Method Source Code

//package com.java2s;
/*/*from   w  w w  .j  a  va 2s  .  c  o  m*/
 * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.nio.file.Files;
import java.nio.file.Path;

public class Main {
    /**
     * Is {@code path} is a valid ballerina project directory.
     *
     * @param path path to suspecting dir
     * @return if {@code path} is a ballerina project directory or not
     */
    public static boolean isBallerinaProject(Path path) {
        boolean isProject = false;
        Path cachePath = path.resolve(".ballerina");

        // .ballerina cache path should exist in ballerina project directory
        if (Files.exists(cachePath)) {
            isProject = true;
        }

        return isProject;
    }
}

Related

  1. isAbsolute(String path)
  2. isAbsolutePath(String path)
  3. isAsciiText(Path p)
  4. isBinary(Path file)
  5. isContained(Path contained, Path container)
  6. isDirectory(Path fileOrDir, LinkOption... options)
  7. isDirectory(Path value)