Create the output directory for the entry if needed.
182856
def create_dir(entry, section, domain, output):
    """"""
    full_output_dir = os.path.join(output, section, domain, entry['assembly_accession'])
    try:
        os.makedirs(full_output_dir)
    except OSError as err:
        if err.errno == errno.EEXIST and os.path.isdir(full_output_dir):
            pass
        else:
            raise

    return full_output_dir
620267
def output_directory(self) -> str:
        

        return os.path.join(self.results_path, 'reports', self.uuid, 'latest')
296340
def create_working_dir(config, prefix):
    '''
        
    '''
    # Fetch base directory from executor configuration
    basepath = config.get("Execution", "directory")

    if not prefix:
        prefix = 'opensubmit'

    finalpath = tempfile.mkdtemp(prefix=prefix + '_', dir=basepath)
    if not finalpath.endswith(os.sep):
        finalpath += os.sep
    logger.debug("Created fresh working directory at {0}.".format(finalpath))

    return finalpath
61186
def make(directory):
    """"""

    if os.path.exists(directory):
        if os.path.isdir(directory):
            click.echo('Directory already exists')
        else:
            click.echo('Path exists and is not a directory')
        sys.exit()

    os.makedirs(directory)
    os.mkdir(os.path.join(directory, 'jsons'))
    copy_default_config(os.path.join(directory, 'config.yaml'))
366487
def create(self):
        """"""
        self.logger.log(logging.DEBUG, 'os.mkdir %s', self.name)
        os.mkdir(self.name)
55408
public void setOutputDirectory( String outputDirectory ) {

		// Update the configuration
		this.logger.fine( "Output directory is now... " + outputDirectory );
		this.outputDIR = Utils.isEmptyOrWhitespaces( outputDirectory ) ? null : new File( outputDirectory );

		// Generate the files
		if( this.outputDIR != null && this.dm != null ) {
			for( ManagedApplication ma : this.dm.applicationMngr().getManagedApplications())
				application( ma.getApplication(), EventType.CHANGED );
		}
	}


	/**
	 * Binds the DM.
	 * @param dm
	 */
	public void bindManager( Manager dm ) {

		synchronized( this.generationLock ) {
			this.logger.fine( "The DM is now available in the templating manager." );
			this.dm = dm;
		}
	}


	/**
	 * Unbinds the DM.
	 * @param dm
	 */
	public void unbindManager( Manager dm ) {

		synchronized( this.generationLock ) {
			this.logger.fine( "The DM is NOT available anymore in the templating manager." );
			this.dm = null;
		}
	}


	// iPojo life cycle


	/**
	 * Starts the templating manager (invoked by iPojo).
	 */
	public void start() {

		synchronized( this.watcherLock ) {
			this.logger.config( "The templating manager is starting..." );
			resetWatcher();
		}
	}


	/**
	 * Stops the templating manager (invoked by iPojo).
	 */
	public void stop() {

		synchronized( this.watcherLock ) {
			this.logger.config( "The templating manager is stopping..." );
			stopWatcher();
		}
	}


	// Inherited methods


	/*
	 * (non-Javadoc)
	 * @see net.roboconf.dm.management.events.IDmListener#getId()
	 */
	@Override
	public String getId() {
		return ID;
	}


	/* (non-Javadoc)
	 * @see net.roboconf.dm.management.events.IDmListener
	 * #application(net.roboconf.core.model.beans.Application, net.roboconf.dm.management.events.EventType)
	 */
	@Override
	public void application( Application application, EventType eventType ) {

		if( this.outputDIR == null ) {
			this.logger.warning( "Generation from templates is skipped. Invalid output directory." );

		} else if( eventType == EventType.DELETED ) {
			synchronized( this.generationLock ) {
				TemplateUtils.deleteGeneratedFiles( application, this.outputDIR );
			}

		} else {
			generate( application );
		}
	}


	/* (non-Javadoc)
	 * @see net.roboconf.dm.management.events.IDmListener
	 * #applicationTemplate(net.roboconf.core.model.beans.ApplicationTemplate, net.roboconf.dm.management.events.EventType)
	 */
	@Override
	public void applicationTemplate( ApplicationTemplate tpl, EventType eventType ) {
		// nothing
	}


	/*
	 * (non-Javadoc)
	 * @see net.roboconf.dm.management.events.IDmListener
	 * #instance(net.roboconf.core.model.beans.Instance, net.roboconf.core.model.beans.Application, net.roboconf.dm.management.events.EventType)
	 */
	@Override
	public void instance( Instance instance, Application application, EventType eventType ) {
		application( application, EventType.CHANGED );
	}


	/* (non-Javadoc)
	 * @see net.roboconf.dm.management.events.IDmListener
	 * #raw(java.lang.String, java.lang.Object[])
	 */
	@Override
	public void raw( String message, Object... data ) {
		// nothing
	}


	/*
	 * (non-Javadoc)
	 * @see net.roboconf.dm.management.events.IDmListener
	 * #enableNotifications()
	 */
	@Override
	public void enableNotifications() {
		// nothing
	}


	/*
	 * (non-Javadoc)
	 * @see net.roboconf.dm.management.events.IDmListener
	 * #disableNotifications()
	 */
	@Override
	public void disableNotifications() {
		// nothing
	}
1001732
def mkdir(dir, enter):
    

    if not os.path.exists(dir):
        os.makedirs(dir)
14415
public File outputDir(File src, File explicitOutputDir, String mapperName) throws IOException {
        File outputDir;
        int prev;
        int idx;
        File subDir;

        if (explicitOutputDir == null) {
            outputDir = src.getParentFile();
        } else {
            outputDir = explicitOutputDir;
            idx = mapperName.indexOf('.');
            prev = 0;
            while (idx != -1) {
                subDir = new File(outputDir, mapperName.substring(prev, idx));
                if (!subDir.isDirectory()) {
                    if (!subDir.mkdir()) {
                        throw new IOException("cannot create directory: " + subDir);
                    }
                }
                prev = idx + 1;
                idx = mapperName.indexOf('.', prev);
                outputDir = subDir;
            }
        }
        return outputDir;
    }
1036687
function createDirectories(done) {
		debug('createDirectories()');
		var paths = [ options.output ];
		function iterator(dirpath, next) { mkdirp(dirpath, '0755', next); };
		async.forEach(paths, iterator, done);
	}
133376
def create_required_directories(self):
        """"""
        required = (self.CACHE_DIR,
                    self.LOG_DIR,
                    self.OUTPUT_DIR,
                    self.ENGINEER.JINJA_CACHE_DIR,)

        for folder in required:
            ensure_exists(folder, assume_dirs=True)
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;
    }
1095965
private File getDefaultOutputDirectory()
    {
        //The default output directory is the configuration name
        String childOutputDirectory = getConfiguration();
        
        //However, for platforms others than Win32, the default output directory becomes platform/configuration
        if ( ! getPlatform().equals( "Win32" ) )
        {
            childOutputDirectory = new File( getPlatform(), childOutputDirectory ).getPath();
        }
        
        //Place the default output directory within the appropriate base directory
        return new File( getBaseDirectory(), childOutputDirectory );
    }
113778
def set_output(self):
        
        if not self.output:
            return open(devnull, 'w')
        
        # Get the output file path
        output_dir = dirname(self.output)
        
        # Make the path exists
        if not isdir(output_dir):
            try:
                makedirs(output_dir)
            except Exception as e:
                self.die('Failed to create output directory "{}": {}'.format(output_dir, str(e)))
        return open(self.output, 'a')
1101033
def __create_output_dir(base_dir):
    
    root, tail = os.path.split(base_dir)
    dir = None
    if tail:
        if base_dir.endswith('/'):
            dir = base_dir
        else:
            dir = root
    else:
        if base_dir.endswith('/'):
            dir = base_dir
    
    if dir and not os.path.isdir(dir):
        os.makedirs(dir)
1136259
def add_dir_entry(backup_run, dir_entry_path, process_bar, result):
    
    # print(dir_entry_path.pformat())
    # print(dir_entry_path.stat.st_nlink)

    backup_entry = Path2(dir_entry_path.path)
    filesize = dir_entry_path.stat.st_size
    hash_filepath = Path2("%s%s%s" % (backup_entry.path, os.extsep, phlb_config.hash_name))
    if hash_filepath.is_file():
        with hash_filepath.open("r") as hash_file:
            hash_hexdigest = hash_file.read().strip()
        if filesize > 0:
            process_bar.update(filesize)
    else:
        with hash_filepath.open("w") as hash_file:
            callback = HashCallback(process_bar)
            with backup_entry.open("rb") as f:
                hash = calculate_hash(f, callback)

            hash_hexdigest = hash.hexdigest()
            hash_file.write(hash_hexdigest)

    old_backup_entry = deduplicate(backup_entry, hash_hexdigest)
    if old_backup_entry is None:
        result.add_new_file(filesize)
    else:
        result.add_stined_file(filesize)

    BackupEntry.objects.create(
        backup_run, dir_entry_path.path_instance, hash_hexdigest=hash_hexdigest  # Path2() instance
    )
288861
public function createOutputDir()
    {
        $outputDir = $this->configuration->get('output');

        if (!is_writable($outputDir)) {
            @mkdir($outputDir, 0777, true);

            if (!is_writable($outputDir)) {
                throw new \RuntimeException("Output directory {$outputDir} is not writable.");
            }
        }
    }
1329497
def create_readable_dir(entry, section, domain, output):
    """"""
    if domain != 'viral':
        full_output_dir = os.path.join(output, 'human_readable', section, domain,
                                       get_genus_label(entry),
                                       get_species_label(entry),
                                       get_strain_label(entry))
    else:
        full_output_dir = os.path.join(output, 'human_readable', section, domain,
                                       entry['organism_name'].replace(' ', '_'),
                                       get_strain_label(entry, viral=True))

    try:
        os.makedirs(full_output_dir)
    except OSError as err:
        if err.errno == errno.EEXIST and os.path.isdir(full_output_dir):
            pass
        else:
            raise

    return full_output_dir