Package java.io

Examples of java.io.File.mkdirs()


    private boolean writeSettingsFile() {
        // ensure the config directory exists
        final File configDir = new File("config");
        if (!configDir.isDirectory()) {
            configDir.mkdirs(); // if the config dir doesn't exist, we create it
        }

        // write to new file
        final String configDirStr = getValue(SettingsClass.DIR_CONFIG);
        final File newFile = new File(configDirStr + "frost.ini.new");
View Full Code Here


        FileOutputStream fileoutput = null;
        try {
          File file = new File(directory, name + ".class");
          File dir = file.getParentFile();
          if (!dir.exists()) {
            dir.mkdirs();
          }
          fileoutput = new FileOutputStream(file);
          output.writeTo(fileoutput);
        } catch (IOException e) {
        } finally {
View Full Code Here

    public void setOutputDirectoryString(String outputDirectoryString) {
        this.outputDirectoryString = outputDirectoryString;

        try {
            File dir = new File(outputDirectoryString);
            if (dir.exists() || dir.mkdirs()) {
                return;
            }
        } catch (SecurityException se) {
        }
View Full Code Here

     */
    public boolean copy(String toRpfDir) {
        File toDir = new File(toRpfDir);
        boolean ret = false;
        String sourceRpfDir = getRpfDir();
        if ((toDir.exists() || toDir.mkdirs()) && frameList != null) {
            if (verbose) {
                Debug.output("From " + sourceRpfDir + " to " + toRpfDir + ":");
            }
            for (Iterator it = frameList.iterator(); it.hasNext();) {
                String relativeFilePath = "/" + (String) it.next();
View Full Code Here

                String relativeFilePath = "/" + (String) it.next();
                File fromFile = new File(sourceRpfDir + relativeFilePath);
                File toFile = new File(toRpfDir + relativeFilePath);
                File toParent = toFile.getParentFile();
                if (!toParent.exists()) {
                    toParent.mkdirs();
                }
                if (verbose) {
                    Debug.output("Copying " + relativeFilePath);
                }
View Full Code Here

            /* do REDO */
            if ((recoverFlag == LogRecord.REDO) && (operationFlag == FILE_NEW_OPERATION) && (!existFlag)) {
                /* renew the file or recreate the directory */
                if (fileOrDirFlag == DIRECTORY_FLAG) {
                    file.mkdirs();
                } else {
                    file.createNewFile();
                }
            } else
            if (((recoverFlag == LogRecord.REDO) && (operationFlag == FILE_DELETE_OPERATION) && existFlag) || ((recoverFlag == LogRecord.UNDO) && (((operationFlag == FILE_NEW_OPERATION) && existFlag) || (operationFlag == FILE_DELETE_OPERATION) || (operationFlag == FILE_UPDATE_OPE_BYTE)))) {
View Full Code Here

    protected OutputStream getFileLocation(DocumentHolder document) throws IOException {
        Calendar calendar = Calendar.getInstance();
        String constructed = "/" + (document.isImage() ? "images" : document.isAudio() ? "sounds" : document.isVideo() ? "videos" : "docs");
        constructed += "/" + parser.format(calendar.getTime());
        File path = new File(documentRoot, constructed);
        path.mkdirs();
        String identifier = System.currentTimeMillis() + "_" + StringUtils.getFilename(document.getIdentifier());
        document.setUri(constructed + "/" + identifier);
        path = new File(path, identifier);
        path.createNewFile();
        return new FileOutputStream(path);
View Full Code Here

                // set up for output to target location
                File file = new File(m_imageRoot, target);
                System.out.println("Target file path is " + file.getPath() + " with root path " + buff);
                File dir = file.getParentFile();
                if (!dir.exists()) {
                    dir.mkdirs();
                }
               
                // generate site page from template
                FileWriter writer = new FileWriter(file);
                m_template.initDocument();
View Full Code Here

        if (dir.exists() && dir.isDirectory()) {
            FileUtil.removeFileOrDirectory(dir);
        }

        dir.mkdirs();
    }

    /**
     * Create a txn entry for the log, then push it to the entry
     *
 
View Full Code Here

      }
    }

    if (baseDirectoryFile.exists() == false)
    {
      if (baseDirectoryFile.mkdirs() == false)
      {
        throw new ModuleInitializeException
            ("Unable to create the specified directory."); //$NON-NLS-1$
      }
    }
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.