Package org.formic.util

Examples of org.formic.util.File


        // filter out dirs the user doesn't have permission write to.
        ArrayList<String> filtered = new ArrayList<String>();
        if (runtimePath != null){
          for (String path : runtimePath){
            if (new File(path).canWrite()){
              if (Installer.isUninstall()){
                File eclimDir = new File(path + "/eclim");
                if (eclimDir.exists()){
                  if (eclimDir.canWrite()){
                    filtered.add(path);
                  }else{
                    logger.warn(
                        path + "/eclim is not writable by the current user");
                  }
                }
              }else{
                filtered.add(path);
              }
            }
          }
        }
        String[] rtp = filtered.toArray(new String[filtered.size()]);

        if(rtp == null || rtp.length == 0){
          if(!Installer.isUninstall()){
            if(!homeVimCreatePrompted){
              createUserVimFiles("No suitable vim files directory found.");
            }else{
              GuiDialogs.showWarning(
                  "Your vim install is still reporting no\n" +
                  "suitable vim files directories.\n" +
                  "You will need to manually specify one.");
            }
          }
        }else{
          if(rtp.length == 1){
            fileChooser.getTextField().setText(rtp[0]);

            // try to discourage windows users from installing eclim files in
            // their vim installation.
            if(new File(rtp[0] + "/gvim.exe").exists()){
              createUserVimFiles("No user vim files directory found.");
            }
          }else{
            dirList = new JList(rtp);
            dirList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
View Full Code Here


            }
            if (vimfiles.equals(path)){
              continue;
            }

            File fpath = new File(path + "/plugin/eclim.vim");
            if (!fpath.exists()){
              continue;
            }

            if (fpath.canWrite()){
              boolean remove = GuiDialogs.showConfirm(
                  "You appear to have one or more of the eclim vim files\n" +
                  "installed in another directory:\n" +
                  "  " + rpath + "\n" +
                  "Would you like the installer to remove those files now?");
              if (remove){
                Delete delete = new Delete();
                delete.setProject(Installer.getProject());
                delete.setTaskName("delete");
                delete.setIncludeEmptyDirs(true);
                delete.setFailOnError(true);

                FileSet set = new FileSet();
                set.setDir(new File(path + "/eclim"));
                set.createInclude().setName("**/*");
                set.createExclude().setName("after/**/*");
                set.createExclude().setName("resources/**/*");
                delete.addFileset(set);

                try{
                  boolean deleted = fpath.delete();
                  if (!deleted){
                    throw new BuildException(
                        "Failed to delete file: plugin/eclim.vim");
                  }
                  delete.execute();
View Full Code Here

    try{
      String[] gvims = null;
      if(Os.isFamily(Os.FAMILY_WINDOWS)){
        gvims = WINDOWS_GVIMS;
        for (String gvim : gvims){
          if (new File(gvim).isFile()){
            Installer.getProject().setProperty("eclim.gvim", gvim);
            break;
          }
        }
      }else{
View Full Code Here

   * if they want to create the user local directory.
   */
  private void createUserVimFiles(String message)
  {
    homeVimCreatePrompted = true;
    File vimfiles = new File(
        System.getProperty("user.home") + '/' +
        (Os.isFamily(Os.FAMILY_WINDOWS) ? "vimfiles" : ".vim"));
    System.out.println(
        "Checking for user vim files directory: " + vimfiles);
    if(!vimfiles.exists()){
      boolean create = GuiDialogs.showConfirm(
          message + "\n" +
          "Would you like to create the standard\n" +
          "directory for your system?\n" +
          vimfiles);
      if(create){
        boolean created = vimfiles.mkdir();
        if(created){
          rtpAttempted = false;
          displayed();
        }else{
          GuiDialogs.showError("Unable to create directory: " + vimfiles);
        }
      }
    }else{
      fileChooser.getTextField().setText(
          vimfiles.getAbsolutePath().replace('\\', '/'));
    }
  }
View Full Code Here

    try{
      String contents = IOUtils.toString(in = new FileInputStream(file));
      String[] paths = StringUtils.stripAll(StringUtils.split(contents, ','));
      ArrayList<String> results = new ArrayList<String>();
      for (String path : paths){
        if(new File(path).isDirectory()){
          results.add(path.replace('\\', '/'));
        }
      }
      return results.toArray(new String[results.size()]);
    }catch(Exception e){
View Full Code Here

TOP

Related Classes of org.formic.util.File

Copyright © 2018 www.massapicom. 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.