Sets the output directory, creates it if needed
This must be called before saving a file

@throws Exception If the dir can't be created and dont already exists
508453
private function setOutputDirectory()
    {
        $outputDirectory = $this->config->get('outputDir');

        //Try to create output dir if non existing
        if (is_dir($outputDirectory) == false) {
            if (mkdir($outputDirectory, 0777, true) == false) {
                throw new Exception('Could not create output directory and it does not exist!');
            }
        }

        $this->dir = $outputDirectory;
    }
386961
def set_outdir(self):
        """"""
        dirname = self.w.outdir.get_text()
        if os.path.isdir(dirname):
            self.outdir = dirname
            self.logger.debug('Output directory set to {0}'.format(self.outdir))
        else:
            self.w.outdir.set_text(self.outdir)
            self.logger.error('{0} is not a directory'.format(dirname))
1329570
public static void createFile(File file) throws Exception {
    File dir = new File(file.getAbsolutePath().replace(File.separator + file.getName(), ""));
    if(!dir.exists()) {
      if(!dir.mkdirs()) {
        throw new Exception("Can't create dirs "+dir);
      }
    }
    file.createNewFile();
  }
318825
private synchronized void prepareFile() throws IOException{
		outputFile = new File(getFileName());
		if(outputFile.exists()) 
			outputFile.delete();
		if(outputFile.isDirectory())
			throw new IOException("I/O Error on creating file: File is a directory!");
		outputFile.createNewFile();
		if(!outputFile.canWrite())
			throw new IOException("I/O Error on creating file: Unable to write into file!");
	}
643838
public static void setOutputPath(JobConf conf, Path outputDir) {
    if (!outputDir.isAbsolute()) {
      FileSystem.LogForCollect.info("set output path to relative path: "
          + outputDir + " working directory: " + conf.getWorkingDirectory());
    }
    outputDir = new Path(conf.getWorkingDirectory(), outputDir);
    conf.set("mapred.output.dir", outputDir.toString());
  }
685638
@VisibleForTesting
	static void createUploadDir(final Path uploadDir, final Logger log, final boolean initialCreation) throws IOException {
		if (!Files.exists(uploadDir)) {
			if (initialCreation) {
				log.info("Upload directory {} does not exist. " + uploadDir);
			} else {
				log.warn("Upload directory {} has been deleted externally. " +
					"Previously uploaded files are no longer available.", uploadDir);
			}
			checkAndCreateUploadDir(uploadDir, log);
		}
	}
642340
private function _createFile($dir, $name, $ext)
    {
        if (!empty($this->rootDir)) {
            if (!file_exists($this->_getFileDir($dir))) {
                mkdir($this->_getFileDir($dir), 0777, true);
            }
            if (!file_exists($this->_getFilePath($dir, $name, $ext))) {
                if (file_put_contents($this->_getFilePath($dir, $name, $ext), '') === false) {
                    throw new \Exception("Could not create $ext for {$this->username}.");
                }
            }
        }
    }
529864
public static function createDir($dir)
    {
        try {
            if (!is_dir($dir) && @mkdir($dir, 0775, true) === false) {
                throw new \Exception(t('Can\'t create directory ') . $dir);
            }
        } catch (\Exception $e) {
            Logger::log($e->getMessage(), LOG_WARNING);
            if (!file_exists(dirname($dir))) {
                throw new GeneratorException($e->getMessage() . $dir);
            }
        }
    }
972495
public void setDirectory(final String directory) {
        this.directory = new File(this.configuration.getDirectory(), directory);
        if (!this.directory.exists()) {
            throw new IllegalArgumentException(String.format(
                    "Directory does not exist: %s.\n" +
                            "Configuration contained value %s which is supposed to be relative to " +
                            "configuration directory.",
                    this.directory, directory));
        }

        if (!this.directory.getAbsolutePath()
                .startsWith(this.configuration.getDirectory().getAbsolutePath())) {
            throw new IllegalArgumentException(String.format(
                    "All files and directories must be contained in the configuration directory the " +
                            "directory provided in the configuration breaks that contract: %s in config " +
                            "file resolved to %s.",
                    directory, this.directory));
        }
    }
691318
protected function makeOutputDirectory()
	{
		if (file_exists($this->outputPath)) {
			if (!is_null($this->outputInterface)) {
				$this->outputInterface->writeln('<info>Main output directory already created (' . $this->outputPath . ')</info>');
			}
		} else {
			if (!is_null($this->outputInterface)) {
				$this->outputInterface->writeln('<info>Making main output directory (' . $this->outputPath . ')</info>');
			}
			mkdir($this->outputPath, 0755, true);
		}

		$managersDirectoryPath = $this->outputPath . DIRECTORY_SEPARATOR . "Managers";
		if (file_exists($managersDirectoryPath)) {
			if (!is_null($this->outputInterface)) {
				$this->outputInterface->writeln('<info>Managers output directory already created (' . $managersDirectoryPath . ')</info>');
			}
		} else {
			if (!is_null($this->outputInterface)) {
				$this->outputInterface->writeln('<info>Making managers output directory (' . $managersDirectoryPath . ')</info>');
			}
			mkdir($managersDirectoryPath, 0755, true);
		}

		$resourcesDirectoryPath = $this->outputPath . DIRECTORY_SEPARATOR . "Resources";
		if (file_exists($resourcesDirectoryPath)) {
			if (!is_null($this->outputInterface)) {
				$this->outputInterface->writeln('<info>Resources output directory already created (' . $resourcesDirectoryPath . ')</info>');
			}
		} else {
			if (!is_null($this->outputInterface)) {
				$this->outputInterface->writeln('<info>Making resources output directory (' . $resourcesDirectoryPath . ')</info>');
			}
			mkdir($resourcesDirectoryPath, 0755, true);
		}

		/*
		$responsesDirectoryPath = $this->outputPath . DIRECTORY_SEPARATOR . "Responses";
		if (file_exists($responsesDirectoryPath)) {
			if (!is_null($this->outputInterface)) {
				$this->outputInterface->writeln('<info>Responses output directory already created (' . $responsesDirectoryPath . ')</info>');
			}
		} else {
			if (!is_null($this->outputInterface)) {
				$this->outputInterface->writeln('<info>Making responses output directory (' . $responsesDirectoryPath . ')</info>');
			}
			mkdir($responsesDirectoryPath ,0755, true);
		}
		*/

		$exceptionsDirectoryPath = $this->outputPath . DIRECTORY_SEPARATOR . "Exceptions";
		if (file_exists($exceptionsDirectoryPath)) {
			if (!is_null($this->outputInterface)) {
				$this->outputInterface->writeln('<info>Exceptions output directory already created (' . $exceptionsDirectoryPath . ')</info>');
			}
		} else {
			if (!is_null($this->outputInterface)) {
				$this->outputInterface->writeln('<info>Making exceptions output directory (' . $exceptionsDirectoryPath . ')</info>');
			}
			mkdir($exceptionsDirectoryPath, 0755, true);
		}
	}
542359
public void setCompileDirectory(String directory) {
        if (directory != null && directory.trim().length() > 0) {
            File file = new File(directory);
            if (file.exists() || file.mkdirs()) {
                this.compileDirectory = file;
            }
        }
    }
1201914
void genCode() throws IOException {
        if (!outputDirectory.exists()) {
            if (!outputDirectory.mkdirs()) {
                throw new IOException("unable to create output directory "
                        + outputDirectory);
            }
        }
        FileWriter cc = new FileWriter(new File(outputDirectory, mName + ".cc"));
        FileWriter hh = new FileWriter(new File(outputDirectory, mName + ".hh"));

        hh.write("/**\n");
        hh.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
        hh.write("* or more contributor license agreements.  See the NOTICE file\n");
        hh.write("* distributed with this work for additional information\n");
        hh.write("* regarding copyright ownership.  The ASF licenses this file\n");
        hh.write("* to you under the Apache License, Version 2.0 (the\n");
        hh.write("* \"License\"); you may not use this file except in compliance\n");
        hh.write("* with the License.  You may obtain a copy of the License at\n");
        hh.write("*\n");
        hh.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
        hh.write("*\n");
        hh.write("* Unless required by applicable law or agreed to in writing, software\n");
        hh.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
        hh.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
        hh.write("* See the License for the specific language governing permissions and\n");
        hh.write("* limitations under the License.\n");
        hh.write("*/\n");
        hh.write("\n");

        cc.write("/**\n");
        cc.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
        cc.write("* or more contributor license agreements.  See the NOTICE file\n");
        cc.write("* distributed with this work for additional information\n");
        cc.write("* regarding copyright ownership.  The ASF licenses this file\n");
        cc.write("* to you under the Apache License, Version 2.0 (the\n");
        cc.write("* \"License\"); you may not use this file except in compliance\n");
        cc.write("* with the License.  You may obtain a copy of the License at\n");
        cc.write("*\n");
        cc.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
        cc.write("*\n");
        cc.write("* Unless required by applicable law or agreed to in writing, software\n");
        cc.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
        cc.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
        cc.write("* See the License for the specific language governing permissions and\n");
        cc.write("* limitations under the License.\n");
        cc.write("*/\n");
        cc.write("\n");

        hh.write("#ifndef __" + mName.toUpperCase().replace('.', '_') + "__\n");
        hh.write("#define __" + mName.toUpperCase().replace('.', '_') + "__\n");

        hh.write("#include \"recordio.hh\"\n");
        for (Iterator<JFile> i = mInclFiles.iterator(); i.hasNext();) {
            JFile f = i.next();
            hh.write("#include \"" + f.getName() + ".hh\"\n");
        }
        cc.write("#include \"" + mName + ".hh\"\n");

        for (Iterator<JRecord> i = mRecList.iterator(); i.hasNext();) {
            JRecord jr = i.next();
            jr.genCppCode(hh, cc);
        }

        hh.write("#endif //" + mName.toUpperCase().replace('.', '_') + "__\n");

        hh.close();
        cc.close();
    }
421872
public void init() throws Exception {
        userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
        System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());

        if (!cfg.exists()) {

            ConfigurationManager manager = new ConfigurationManager(cfg, false, locateConfigurationProvider());

            try {

                manager.runProjectConfigurationInitializers();

                if (options.isVerbose()) {
                    log.info("CONFIGURATION FILE [" + cfg.getAbsolutePath() + "] CREATION COMPLETE");
                }

            } catch (IOException aux) {
                if (options.isVerbose()) {
                    log.error("The system can't create the file [ " + cfg.getAbsolutePath() + "]");
                }
                if (options.isThrowException()) {
                    System.setProperty("user.dir", userDir);
                    throw aux;
                }
            }

        } else {
            if (options.isVerbose()) {
                log.error("The configuration file [" + cfg.getAbsolutePath() + "] already exists");
            }
        }
        System.setProperty("user.dir", userDir);
    }
1156861
public static void createDirectory(final String directory) {
        if (directory == null) return;
        final File f = new File(directory);
        if (!f.isDirectory()) {
            if (!f.mkdir()) throw new RuntimeException("couldn't create "
                    + directory);
        }
    }
238374
public static void createDirectory( File directory ) throws IOException {

		if( ! directory.exists()
				&& ! directory.mkdirs())
			throw new IOException( "The directory " + directory + " could not be created." );
	}
1232096
private function _create_cache_dir()
    {
        if (! file_exists($this->config['cache_dir'])) {
            try {
                mkdir($this->config['cache_dir'], 0755, TRUE);
            } catch (Exception $e) {
                throw $e;
            }
        }
        
        // Set the cache dir
        $this->cache_dir = $this->config['cache_dir'];
    }
404316
public void create(String outputdir, Program program) {
		types.stream().forEach((type) -> type.createOutput(outputdir, program));
	}