@param VolatileDirectory $temp

@return string
423178
private function getRootPath(VolatileDirectory $temp)
    {
        $fs = $temp->getFilesystem();
        $result = $temp->getPath() . '/unzipped';
        for (; ;) {
            if (count($fs->files($result)) !== 0) {
                break;
            }
            $dirs = $fs->directories($result);
            if (count($dirs) !== 1) {
                break;
            }
            $result = $dirs[0];
        }

        return $result;
    }
224376
public static function get($id, $temp_dir = ''){
		if( !isset(static::$instances[$id]) ){
			static::$instances[$id] = new static($id, $temp_dir);
		}
		return static::$instances[$id];
	}
548608
public function getTempPath(): FilePathInterface
    {
        if ($this->tempPath === null) {
            // Generate a default temporary directory by document root.
            $this->tempPath = FilePath::parse(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'bluemvc' . DIRECTORY_SEPARATOR . sha1($this->documentRoot->__toString()) . DIRECTORY_SEPARATOR);
            self::ensureDirectoryExists($this->tempPath);
        }

        return $this->tempPath;
    }
1237702
def tmpfile (dir=None, prefix="temp", suffix=None):
    """"""
    return tempfile.mkstemp(suffix=suffix, prefix=prefix, dir=dir)[1]
931002
public function copy_content_to_temp($dir = 'files', $fileprefix = 'tempup_') {
        $tempfile = false;
        if (!$dir = make_temp_directory($dir)) {
            return false;
        }
        if (!$tempfile = tempnam($dir, $fileprefix)) {
            return false;
        }
        if (!$this->copy_content_to($tempfile)) {
            // something went wrong
            @unlink($tempfile);
            return false;
        }
        return $tempfile;
    }
1034456
def tmpdir(self):
        
        if self._tmpdir is None:
            self._tmpdir = mkdtemp(prefix="colin-", dir="/var/tmp")
        return self._tmpdir
1198983
public function generateTempFile($file = null): string
    {
        $path = tempnam(sys_get_temp_dir(), self::TEMP_FILE_OR_DIRECTORY_PREFIX);
        if ($file) {
            file_put_contents($path, $file instanceof \SplFileInfo ? (new Parser())->getBinary($file) : $file);
        }
        register_shutdown_function(function () use ($path) {
            if (file_exists($path)) {
                unlink($path);
            }
        });
        return $path;
    }
1329722
public function getTempPath()
    {
        if (!isset($this->_tempPath)) {
            $hash = md5(microtime(true));
            $this->_tempPath = "{$this->basePath}/{$this->tempDir}/{$hash}";
        }

        return $this->_tempPath;
    }
720394
public function main($tempDir = null)
    {
        if (empty($tempDir)) {
            $tempDir = Configure::read('Attachments.tmpUploadsPath');
        }

        if (!Folder::isAbsolute($tempDir)) {
            $this->out('The path must be absolute, "' . $tempDir . '" given.');
            exit;
        }

        $Folder = new Folder();
        if ($Folder->cd($tempDir) === false) {
            $this->out('Path "' . $tempDir . '" doesn\'t seem to exist.');
            exit;
        }

        $dir = new Folder($tempDir);
        $folders = $dir->read();
        $files = $dir->findRecursive();
        $deletedFiles = 0;
        $deletedFolders = 0;

        $this->out('Found ' . count($folders[0]) . ' folders and ' . count($files) . ' files');

        foreach ($files as $filePath) {
            $file = new File($filePath);
            // only delete if last change is longer than 24 hours ago
            if ($file->lastChange() < (time() - 24 * 60 * 60) && $file->delete()) {
                $deletedFiles++;
            }
            $file->close();
        }

        foreach ($folders[0] as $folderName) {
            $folder = new Folder($dir->pwd() . DS . $folderName);
            // only delete if folder is empty
            if ($folder->dirsize() === 0 && $folder->delete()) {
                $deletedFolders++;
            }
        }


        $this->out('Deleted ' . $deletedFolders . ' folders and ' . $deletedFiles . ' files.');
    }
483206
public function getTemporaryDirectory()
    {
        if (!self::$_temporary_directory)
        {
            $result     = false;
            $candidates = array(
                ini_get('upload_tmp_dir'),
                JFactory::getApplication()->getCfg('tmp_path'),
                JPATH_ROOT.'/tmp'
            );

            if (function_exists('sys_get_temp_dir')) {
                array_unshift($candidates, sys_get_temp_dir());
            }

            foreach ($candidates as $folder)
            {
                if ($folder && @is_dir($folder) && is_writable($folder))
                {
                    $result = rtrim($folder, '\\/');
                    break;
                }
            }

            if ($result === false) {
                throw new RuntimeException('Cannot find a writable temporary directory');
            }

            self::$_temporary_directory = $result;
        }

        return self::$_temporary_directory;
    }
1071576
protected function getOutputFileWithFormat($temp_output_filename) {
        if ($this->output_format) {
            return $this->output_format . ':' . escapeshellarg($temp_output_filename);
        }

        return escapeshellarg($temp_output_filename);
    }
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');
    }
203781
public static function getTmpDir() {

		if (!self::$_sTmpDir) {
			$sTmpDir = Config::get('tango')['tmp_dir'];
			$sTmpDir = rtrim($sTmpDir, '/');
			if (!is_dir($sTmpDir) || !is_writable($sTmpDir)) {
				$sTmpDir = '/tmp'; // failback
			}
			self::$_sTmpDir = $sTmpDir;
		}

		return self::$_sTmpDir;
	}
194474
public function makeDirectory($mode = FileSystemPermission::NORMAL)
    {
        $directoryId = $this->generateId();
        $path = sys_get_temp_dir() . '/' . $directoryId;
        $directory = new TemporaryDirectory($path, $mode);

        return $directory;
    }
1170
public function getTempDirectory()
    {
        if (!file_exists($this->tempDirectory)) {
            mkdir($this->tempDirectory, 0777);
            chmod($this->tempDirectory, 0777);
        }

        return $this->tempDirectory;
    }
176281
public static function createTempDir()
    {
        do {
			$folder = sys_get_temp_dir().DIRECTORY_SEPARATOR."tmp".mt_rand().DIRECTORY_SEPARATOR;
		} while (file_exists($folder));
		mkdir($folder);
		return $folder;
    }
297090
function _getTempDir()
    {
        $tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp',
                               'c:\windows\temp', 'c:\winnt\temp');

        /* Try PHP's upload_tmp_dir directive. */
        $tmp = ini_get('upload_tmp_dir');

        /* Otherwise, try to determine the TMPDIR environment variable. */
        if (!strlen($tmp)) {
            $tmp = getenv('TMPDIR');
        }

        /* If we still cannot determine a value, then cycle through a list of
         * preset possibilities. */
        while (!strlen($tmp) && count($tmp_locations)) {
            $tmp_check = array_shift($tmp_locations);
            if (@is_dir($tmp_check)) {
                $tmp = $tmp_check;
            }
        }

        /* If it is still empty, we have failed, so return false; otherwise
         * return the directory determined. */
        return strlen($tmp) ? $tmp : false;
    }