Gets the working directory, creating a temporary one if one was not
specified during construction.
@return The working directory.
968608
private synchronized File getWorkingDirectory() {
    if (workingDirectory == null) {
      try {
        workingDirectory =
            Files.createTempDirectory(TEMP_DIRECTORY_PREFIX).toFile();
      } catch (IOException e) {
        throw new UnexpectedException(e);
      }
    }
    return workingDirectory;
  }
974065
public String getBasePath() {
        StringBuilder sb = new StringBuilder(getBaseDirUnchecked().getAbsolutePath());
        if (!getBaseDirUnchecked().exists()) {
            sb.append(" (non-existent!)");
        } else if (!getBaseDirUnchecked().isDirectory()) {
            sb.append(" (no directory!)");
        } else {
            sb.append(" (Free: ").append(NLS.formatSize(getBaseDir().getFreeSpace())).append(")");
        }

        return sb.toString();
    }
178104
public static File getProjectDirectory(final File currentDir)
	{
		final String projectPath = PathFinder.getAbsolutePath(currentDir, true);
		final File projectFile = new File(projectPath);
		return projectFile;
	}
711542
private File getNextTempDirectory() throws AnalysisException {
        File directory;

        // getting an exception for some directories not being able to be
        // created; might be because the directory already exists?
        do {
            final int dirCount = DIR_COUNT.incrementAndGet();
            directory = new File(tempFileLocation, String.valueOf(dirCount));
        } while (directory.exists());
        if (!directory.mkdirs()) {
            throw new AnalysisException(String.format(
                    "Unable to create temp directory '%s'.",
                    directory.getAbsolutePath()));
        }
        return directory;
    }
609182
protected File getGeneratedResourcesDirectory() {
    if (generatedResourcesFolder == null) {
      String generatedResourcesFolderAbsolutePath = this.project.getBuild().getDirectory() + "/" + getGeneratedResourcesDirectoryPath();
      generatedResourcesFolder = new File(generatedResourcesFolderAbsolutePath);
      if (!generatedResourcesFolder.exists()) {
        generatedResourcesFolder.mkdirs();
      }
    }
    return generatedResourcesFolder;
  }
1305400
private static function getWorkbenchPath()
    {
        if (empty(self::$workbenchPath)) {
            self::$workbenchPath = sprintf(
                '%s%s%s%s',
                self::getBasePath(),
                DIRECTORY_SEPARATOR,
                time(),
                rand(100, 999)
            );
        }
        return self::$workbenchPath;
    }
699674
@VisibleForTesting
    URI getBaseDir() {
        URI baseDir = job.getInputDir();

        final Collection<FileInfo> fis = job.getFileInfo();
        for (final FileInfo fi : fis) {
            final URI res = fi.result.resolve(".");
            baseDir = Optional.ofNullable(getCommonBase(baseDir, res)).orElse(baseDir);
        }

        return baseDir;
    }
401537
public static String locateOrCreateDirectory(String dirName) throws IOException {
    String path = locateDirectory(dirName);

    if (path == null) {
      File file = new File(dirName);
      file.mkdirs();
      path = file.getCanonicalPath();
    }

    return path;
  }
1183309
public final R getSomeBuildWithWorkspace() {
        int cnt=0;
        for (R b = getLastBuild(); cnt<5 && b!=null; b=b.getPreviousBuild()) {
            FilePath ws = b.getWorkspace();
            if (ws!=null)   return b;
        }
        return null;
    }
1176237
public static File getTempDir(){
        String p = System.getProperty(ND4JSystemProperties.ND4J_TEMP_DIR_PROPERTY);
        if(p == null || p.isEmpty()){
            return new File(System.getProperty("java.io.tmpdir"));
        } else {
            return new File(p);
        }
    }
107945
private File getProjectDir(String projectId, boolean create) throws IOException {
        File projectDir = new File(getKeenCacheDirectory(), projectId);
        if (create && !projectDir.exists()) {
            KeenLogging.log("Cache directory for project '" + projectId + "' doesn't exist. " +
                    "Creating it.");
            if (!projectDir.mkdirs()) {
                throw new IOException("Could not create project cache directory '" +
                        projectDir.getAbsolutePath() + "'");
            }
        }
        return projectDir;
    }
182745
public static File getCacheDir ()
    {
        if (_tmpdir == null) {
            String tmpdir = System.getProperty("java.io.tmpdir");
            if (tmpdir == null) {
                log.info("No system defined temp directory. Faking it.");
                tmpdir = System.getProperty("user.home");
            }
            setCacheDir(new File(tmpdir));
        }
        return _tmpdir;
    }
1359859
public function getCompileDir()
	{
		if ($this->compileDir === null) {
			$this->setCompileDir(dirname(__FILE__).DIRECTORY_SEPARATOR.'compiled'.DIRECTORY_SEPARATOR);
		}

		return $this->compileDir;
	}
556466
public static File getPath(){
		if (path==null) {
			UserConfiguration config = new UserConfiguration();
			path = new File(config.getCacheFilePath());
		}
		return path;
	}
194432
public static String getTempDir() {
        synchronized (FileUtil.class) {
            if (TEMP_DIR == null) {
                // Get the 'java.io.tmpdir' property
                String tmpDir = System.getProperty("java.io.tmpdir");

                if (StringUtil.isEmpty(tmpDir)) {
                    // Stupid fallback...
                    // TODO: Delegate to FileSystem?
                    if (new File("/temp").exists()) {
                        tmpDir = "/temp";  // Windows
                    }
                    else {
                        tmpDir = "/tmp";   // Unix
                    }
                }
                TEMP_DIR = tmpDir;
            }
        }
        return TEMP_DIR;
    }
609908
@javax.annotation.Nonnull
  public File getResourceDir() {
    @javax.annotation.Nonnull final File etc = new File(workingDir, "etc");
    etc.mkdirs();
    return etc;
  }
454837
public function dir()
    {
        $this->_name = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid($this->_prefix);
        if (!mkdir($this->_name)) {
            throw new \Exception('Cannot create temporary directory');
        }
        return $this;
    }