returns the Temp Directory of the System

@return temp directory
335494
public static File getTempDirectory() {
	if (tempFile != null) return tempFile;

	final String tmpStr = System.getProperty("java.io.tmpdir");
	if (tmpStr != null) {
	    tempFile = new File(tmpStr);
	    if (tempFile.exists()) {
		tempFile = getCanonicalFileEL(tempFile);
		return tempFile;
	    }
	}
	try {
	    final File tmp = File.createTempFile("a", "a");
	    tempFile = tmp.getParentFile();
	    tempFile = getCanonicalFileEL(tempFile);
	    tmp.delete();
	}
	catch (final IOException ioe) {}

	return tempFile;
    }
221902
public static File getTempDir() {
        final String str = System.getProperty(TEMP_DIR_KEY);
        if (str == null) {
            throw new IllegalStateException("System property '" + TEMP_DIR_KEY + "' not found!");
        }
        final String tempDirStr = str.trim();
        if (tempDirStr.length() == 0) {
            throw new IllegalStateException("System property '" + TEMP_DIR_KEY + "' is empty!");
        }
        final File dir = new File(tempDirStr);
        try {
            checkValidDir(dir);
        } catch (final IllegalArgumentException ex) {
            throw new IllegalStateException("System property '" + TEMP_DIR_KEY + "' is not valid! [" + ex.getMessage() + "]");
        }
        return dir;
    }
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);
        }
    }
867849
private static function getTemporaryFile() {
        if(is_callable(self::$temp)) {
            $temporaryFile = @call_user_func(self::$temp);
            if(is_string($temporaryFile) && strlen($temporaryFile) && is_writable($temporaryFile)) {
                return $temporaryFile;
            }
        }
        $temporaryDirectory = (is_string(self::$temp) && strlen(self::$temp)) ? self::$temp : sys_get_temp_dir();
        return tempnam($temporaryDirectory, 'Zip');
    }
540945
public static function getTempFolder($base)
    {
        $parent = static::getTempParentFolder($base);

        // The actual temp folder is a subfolder of getTempParentFolder(), named by username
        $subfolder = Path::join($parent, static::getTempFolderUsername());

        if (!@file_exists($subfolder)) {
            mkdir($subfolder);
        }

        return $subfolder;
    }
1088356
protected function getTmpPath()
        {
            $tmpDir = sys_get_temp_dir();

            if (!empty($this->prefix)) {
                $tmpDir .= DIRECTORY_SEPARATOR . $this->prefix;
            }

            $tmpDir .= DIRECTORY_SEPARATOR . uniqid('run-', true);

            return $tmpDir;
        }
1369957
public static function createTmpDir() {
        $tmpDir = sys_get_temp_dir();
        $tmpDir .= $tmpDir[strlen($tmpDir) - 1] !== '/' ? '/' : '';
        $tmpDir .= uniqid() . '/';
        if (mkdir($tmpDir)) {
            return $tmpDir;
        } else {
            throw new Exception('Could not create directory ' . $tmpDir);
        }
    }
40408
public function getDirectory()
    {
        $dir = new Directory($this->getDirname());

        $namespaces = explode('\\', $this->getNameSpace());
        array_pop($namespaces);
        $dir->setNamespace(join('\\', $namespaces));

        return $dir;
    }
782164
function temp_dir()
    {
        $dir = '';
        if (function_exists('sys_get_temp_dir')) {
            $dir = sys_get_temp_dir();
        }
        if (!$dir && $tmp = getenv('TMP')) {
            $dir = $tmp;
        }
        if (!$dir && $tmp = getenv('TEMP')) {
            $dir = $tmp;
        }
        if (!$dir && $tmp = getenv('TMPDIR')) {
            $dir = $tmp;
        }
        if (!$dir) {
            $tmp = tempnam(__FILE__, '');
            if (file_exists($tmp)) {
                unlink($tmp);
                $dir = dirname($tmp);
            }
        }
        if (!$dir) {
            return '';
        }
        $slash = (strtolower(substr(PHP_OS, 0, 3)) === 'win' ? '\\' : '/');
        if (substr($dir, -1) != $slash) {
            $dir = $dir . $slash;
        }

        return $dir;
    }
391908
public TempFileNameScheme getTempFileNameScheme() {
        final TempFileNameScheme tempFileNameScheme;
        try {
            final String cls = Optional
                    .ofNullable(getProperty("temp-file-name-scheme"))
                    .orElse(configuration.get("temp-file-name-scheme"));
            tempFileNameScheme = (GenMapAndTopicListModule.TempFileNameScheme) Class.forName(cls).newInstance();
        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
        tempFileNameScheme.setBaseDir(getInputDir());
        return tempFileNameScheme;
    }
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;
  }
322467
public static String findATmpDir(){
        String osTmpDir = new Os.TmpDirFinder().get().get();
        return osTmpDir + File.separator +
                BROOKLYN_DIR + File.separator +
                Strings.makeRandomId(8);
    }
213608
public TempFile createTempFile() throws IOException {
		TempFile tempFile = new TempFile(prefix, suffix, directory);
		synchronized(tempFiles) {
			tempFiles.add(new WeakReference<>(tempFile));
		}
		return tempFile;
	}
308901
public static function createTemporary() {
    $file = File::createTemporary();
    $tempname = $file->getName();
    $file->delete();
    
    $dir = $file->getDirectory()->sub($tempname.'/');
    $dir->make();
    return $dir;
  }
410460
def getTempDirectory(rootDir=None):
    
    if rootDir is None:
        return tempfile.mkdtemp()
    else:
        if not os.path.exists(rootDir):
            try:
                os.makedirs(rootDir)
            except OSError:
                # Maybe it got created between the test and the makedirs call?
                pass
            
        while True:
            # Keep trying names until we find one that doesn't exist. If one
            # does exist, don't nest inside it, because someone else may be
            # using it for something.
            tmpDir = os.path.join(rootDir, "tmp_" + getRandomAlphaNumericString())
            if not os.path.exists(tmpDir):
                break
                
        os.mkdir(tmpDir)
        os.chmod(tmpDir, 0777) #Ensure everyone has access to the file.
        return tmpDir
381017
public static Resource temporaryDirectory() {
      File tempDir = new File(SystemInfo.JAVA_IO_TMPDIR);
      String baseName = System.currentTimeMillis() + "-";
      for (int i = 0; i < 1_000_000; i++) {
         File tmp = new File(tempDir, baseName + i);
         if (tmp.mkdir()) {
            return new FileResource(tmp);
         }
      }
      throw new RuntimeException("Unable to create temp directory");
   }
360150
public String getDestDirectory()
	{
		String strTargetDirectory = this.getInitParameter(DESTINATION);		// Passed with WAR file
		if ((strTargetDirectory == null) || (strTargetDirectory.length() == 0))
			strTargetDirectory = System.getProperty("java.io.tmpdir");		// Temporary directory
		if ((strTargetDirectory == null) || (strTargetDirectory.length() == 0))
			strTargetDirectory = ".";										// Last choice - this directory
		return strTargetDirectory;
	}