Determine directory to log import/export reports to
1664
private File determineLogDirectory(final BatchOptions options, String operation) {
        File logDirectoryParent = options != null ? options.getLogDirectoryParent() : null;
        if (logDirectoryParent == null) {
            logDirectoryParent = Files.createTempDir();
        }
        File logDirectory = new File(logDirectoryParent, "data-" + operation + "-reports");
        try {
            logDirectory = logDirectory.getCanonicalFile();
            FileUtils.deleteDirectory(logDirectory);
        } catch (IOException e) {
            throw new RuntimeException(
                    "Failed to clean data-" + operation + " log directory: " + logDirectory, e);
        }
        logDirectory.mkdirs();
        return logDirectory;
    }
1205027
protected void scrubExportFolders(I_CmsReport report) {

        if (report != null) {
            report.println(
                Messages.get().container(Messages.RPT_DELETING_EXPORT_FOLDERS_BEGIN_0),
                I_CmsReport.FORMAT_HEADLINE);
        }
        synchronized (m_lockScrubExportFolders) {
            int count = 0;
            Integer size = new Integer(m_rfsRules.size() + 1);
            // default case
            String exportFolderName = CmsFileUtil.normalizePath(m_staticExportPath + '/');
            try {
                File exportFolder = new File(exportFolderName);
                // check if export file exists, if so delete it
                if (exportFolder.exists() && exportFolder.canWrite()) {
                    CmsFileUtil.purgeDirectory(exportFolder);
                }
                count++;
                if (report != null) {
                    report.println(
                        Messages.get().container(
                            Messages.RPT_DELETE_EXPORT_FOLDER_3,
                            new Integer(count),
                            size,
                            exportFolderName),
                        I_CmsReport.FORMAT_NOTE);
                } else {
                    // write log message
                    if (LOG.isInfoEnabled()) {
                        LOG.info(Messages.get().getBundle().key(Messages.LOG_DEL_MAIN_SE_FOLDER_1, exportFolderName));
                    }
                }
            } catch (Throwable t) {
                // ignore, nothing to do about the
                if (LOG.isWarnEnabled()) {
                    LOG.warn(
                        Messages.get().getBundle().key(Messages.LOG_FOLDER_DELETION_FAILED_1, exportFolderName),
                        t);
                }
            }
            // iterate over the rules
            Iterator<CmsStaticExportRfsRule> it = m_rfsRules.iterator();
            while (it.hasNext()) {
                CmsStaticExportRfsRule rule = it.next();
                exportFolderName = CmsFileUtil.normalizePath(rule.getExportPath() + '/');
                try {
                    File exportFolder = new File(exportFolderName);
                    // check if export file exists, if so delete it
                    if (exportFolder.exists() && exportFolder.canWrite()) {
                        CmsFileUtil.purgeDirectory(exportFolder);
                    }
                    count++;
                    if (report != null) {
                        report.println(
                            Messages.get().container(
                                Messages.RPT_DELETE_EXPORT_FOLDER_3,
                                new Integer(count),
                                size,
                                exportFolderName),
                            I_CmsReport.FORMAT_NOTE);
                    } else {
                        // write log message
                        if (LOG.isInfoEnabled()) {
                            LOG.info(
                                Messages.get().getBundle().key(Messages.LOG_DEL_MAIN_SE_FOLDER_1, exportFolderName));
                        }
                    }
                } catch (Throwable t) {
                    // ignore, nothing to do about the
                    if (LOG.isWarnEnabled()) {
                        LOG.warn(
                            Messages.get().getBundle().key(Messages.LOG_FOLDER_DELETION_FAILED_1, exportFolderName),
                            t);
                    }
                }
            }
        }
        if (report != null) {
            report.println(
                Messages.get().container(Messages.RPT_DELETING_EXPORT_FOLDERS_END_0),
                I_CmsReport.FORMAT_HEADLINE);
        }
    }
883761
function searchForArrowCloudLogDir() {
	if (isWritable('/ctlog')) {
		return '/ctlog';
	}
	if (process.env.HOME && isWritable(path.join(process.env.HOME, 'ctlog'))) {
		return path.join(process.env.HOME, 'ctlog');
	}
	if (process.env.USERPROFILE && isWritable(path.join(process.env.USERPROFILE, 'ctlog'))) {
		return path.join(process.env.USERPROFILE, 'ctlog');
	}
	if (isWritable('./logs')) {
		return path.resolve('./logs');
	}
	throw new Error('No writable logging directory was found.');
}
1298615
def exported_disks_paths(self):
        
        return [
            os.path.join(self._dst, os.path.basename(disk['path']))
            for disk in self._collect()
        ]
280820
def save_report(session):
    '''
    
    '''
    # prune this folder to contain the last 10 sessions
    previous_reports = glob.glob(os.path.join(report_dir(), '*.pyireport'))
    previous_reports.sort(reverse=True)
    while len(previous_reports) > 10:
        report_file = previous_reports.pop()
        os.remove(report_file)

    identifier = time.strftime('%Y-%m-%dT%H-%M-%S', time.localtime(session.start_time))

    path = os.path.join(
        report_dir(),
        identifier + '.pyireport'
    )
    session.save(path)
    return path, identifier
871758
function getOutputDir(output) {
  var arr = output.split(path.sep);
  arr.pop();
  return arr.join(path.sep);
}
204108
private String getLogDir() {
        StringBuffer output = new StringBuffer();
        WsLocationAdmin locationAdmin = locationAdminRef.getService();
        output.append(locationAdmin.resolveString("${server.output.dir}").replace('\\', '/')).append("/logs");
        return output.toString();
    }
990651
def local_path_export(at_start=True, env_cmd=None):
    
    paths = [get_bcbio_bin()]
    if env_cmd:
        env_path = os.path.dirname(get_program_python(env_cmd))
        if env_path not in paths:
            paths.insert(0, env_path)
    if at_start:
        return "export PATH=%s:\"$PATH\" && " % (":".join(paths))
    else:
        return "export PATH=\"$PATH\":%s && " % (":".join(paths))
391142
def log_path(cls, project, log):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/logs/{log}", project=project, log=log
        )
1160613
private File getLogsDirectory() {
        if (logsDirectory != null) {
            return logsDirectory;
        }
        logsDirectory = new File(SeLionGridConstants.LOGS_DIR);

        if (!logsDirectory.exists()) {
            logsDirectory.mkdirs();
        }

        return logsDirectory;
    }
320270
def logdir(self):
    """"""

    run_name = ncluster_globals.get_run_for_task(self)
    logdir = ncluster_globals.get_logdir(run_name)
    if logdir:
      return logdir

    # create logdir. Only single task in a group creates the logdir
    if ncluster_globals.is_chief(self, run_name):
      chief = self
    else:
      chief = ncluster_globals.get_chief(run_name)

    chief.setup_logdir()
    return ncluster_globals.get_logdir(run_name)
126418
public void prettyPrintsReport(File logDir) throws Exception {
        if ((!logDir.exists()) || (!logDir.isDirectory())) {
            throw new Exception("Error: LOGDIR " + logDir.getAbsolutePath()
                    + " seems not a valid directory. ");
        }
        File html_logs_report_file = new File(logDir.getAbsolutePath()
                + File.separator + "report.html");
        prettyPrintsReport(logDir, html_logs_report_file);
    }
1154992
def pwd(editor, location):
    "  "
    try:
        os.chdir(location)
    except OSError as e:
        editor.show_message('{}'.format(e))
1195308
private Path getTaskReportsFileFromId(String taskId)
  {
    return new Path(mergePaths(config.getDirectory(), taskId.replace(':', '_') + ".reports.json"));
  }
1314581
function getCoverageReport (folder) {
        var reports = grunt.file.expand(folder + '*/index.html');

        if (reports && reports.length > 0) {
            return reports[0];
        }

        return '';
    }
499001
def get_windows_dir():
    """"""
    try:
        import win32api
    except ImportError:
        windir = compat.getenv('SystemRoot', compat.getenv('WINDIR'))
    else:
        windir = win32api.GetWindowsDirectory()
    if not windir:
        raise SystemExit("Error: Can not determine your Windows directory")
    return windir
936486
def log_path(scraper):
    
    return os.path.join(scraper.config.data_path,
                        '%s.jsonlog' % scraper.name)