Package java.io

Examples of java.io.File.canExecute()


    //given
    final File tempFile = folder.newFile("thefile.txt");
    //when
    tempFile.setExecutable(true;
    //then
    assertThat(tempFile.canExecute(), is(true));
  }
}
View Full Code Here


     */
    public String getVmdkBkpPath()
    {
        String vmdkBkpPath = cfg_.getVal(global_, VMDKBKP_PATH);
        File vmdkBkp = new File(vmdkBkpPath);
        if (vmdkBkp.isFile() && vmdkBkp.canExecute()) {
            return vmdkBkpPath;
        } else {
            logger_.warning
                (String.format
                 ("%s is not found.", vmdkBkpPath));
View Full Code Here

    Process process;
    try {
      logger.branch(Type.INFO, String.format("Preparing JBoss AS instance (%s)", JBOSS_START));
      final File startScript = new File(JBOSS_START);
      if (!startScript.canExecute() && !startScript.setExecutable(true)) {
        logger.log(Type.ERROR, "Can not execute " + JBOSS_START);
        throw new UnableToCompleteException();
      }
      ProcessBuilder builder = new ProcessBuilder(JBOSS_START, "-c", TMP_CONFIG_FILE);
View Full Code Here

      {
        harness.fail("cannot create file for test.");
        return;
      }

    boolean execute = tmpfile.canExecute();

    // false because this file was just created
    harness.check(execute == false);

    execute = tmpfile.setExecutable(true);
View Full Code Here

    harness.check(execute == false);

    execute = tmpfile.setExecutable(true);
    harness.check(execute == true);

    execute = tmpfile.canExecute();
    harness.check(execute == true);
   
    tmpfile.delete();
  }
}
View Full Code Here

      String[] split = path.split(File.pathSeparator);
      for(String s : split) {
          File f = new File(s);
          if(f.exists() && f.isDirectory()) {
              f = new File(f, toFind);
              if(f.exists() && f.canExecute()) {
                  if(!f.canRead()) {
                      Logger.error(this, "On path and can execute but not read, so can't check whether it is a script?!: "+f);
                      return false;
                  }
                  if(f.length() < SCRIPT_HEAD.length) {
View Full Code Here

        for (String dataDir : dirs)
        {
            logger.debug("Checking directory {}", dataDir);
            File dir = new File(dataDir);
            if (dir.exists())
                assert dir.isDirectory() && dir.canRead() && dir.canWrite() && dir.canExecute()
                    : String.format("Directory %s is not accessible.", dataDir);
        }

        if (CacheService.instance == null) // should never happen
            throw new RuntimeException("Failed to initialize Cache Service.");
View Full Code Here

    public static String getStartScriptPrefix(ProcessInfo serverProcess, ProcessInfo thisProcess) {
        String prefix = null;
        if (!OS_IS_WINDOWS) {
            StringBuilder buffer = new StringBuilder();
            File nohup = new File(NOHUP_PATH);
            if (nohup.canExecute()) {
                buffer.append(nohup.getPath());
            }
            File sudo = new File(SUDO_PATH);
            if (sudo.canExecute() && (serverProcess.getCredentials() != null) &&
                    (thisProcess.getCredentials() != null)) {
View Full Code Here

            File nohup = new File(NOHUP_PATH);
            if (nohup.canExecute()) {
                buffer.append(nohup.getPath());
            }
            File sudo = new File(SUDO_PATH);
            if (sudo.canExecute() && (serverProcess.getCredentials() != null) &&
                    (thisProcess.getCredentials() != null)) {
                long processUid = serverProcess.getCredentials().getUid();
                long processGid = serverProcess.getCredentials().getGid();
                long agentProcessUid = thisProcess.getCredentials().getUid();
                long agentProcessGid = thisProcess.getCredentials().getGid();
View Full Code Here

        File dir = new File(basedir);
        if (!dir.exists()) {
            throw new IllegalArgumentException("Directory " + dir.getAbsolutePath() + " does not exist");
        }
        if (!dir.canExecute() || !dir.canRead()) {
            throw new IllegalArgumentException("Directory " + dir.getAbsolutePath() + " can not be accessed");
        }

        VirtualFile root = VFS.getChild(dir.toURI());
        List<VirtualFile> matches = root.getChildrenRecursively(Filters.and(this.filter, this.blacklistFilter));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.