With cadir setting saying to save all the stuff to a tempdir :)
342646
def with_temp_dirs(tmpdir, &block)
      fixtures_dir = File.join(tmpdir, 'fixtures')
      ca_dir = File.join(tmpdir, 'ca')
      ssl_dir = File.join(tmpdir, 'ssl')

      FileUtils.mkdir_p fixtures_dir
      FileUtils.mkdir_p ca_dir
      FileUtils.mkdir_p ssl_dir

      config_file = File.join(fixtures_dir, 'puppet.conf')

      File.open(config_file, 'w') do |f|
        f.puts <<-CONF
        [master]
          cadir = #{ca_dir}
          ssldir = #{ssl_dir}
          keylength = 512
        CONF
      end
      block.call(config_file)
    end
1308443
private Path getTempDir() {
    if (this.tempDir == null) {
      if (this.dir != null) {
        this.tempDir = dir;
      } else {
        this.tempDir = getProject().getBaseDir().toPath();
      }
    }
    return tempDir;
  }
215404
def override_temp(replacement):
    
    pkg_resources.py31compat.makedirs(replacement, exist_ok=True)

    saved = tempfile.tempdir

    tempfile.tempdir = replacement

    try:
        yield
    finally:
        tempfile.tempdir = saved
432840
function copyToTemp () {
    fs.readFile(inPath, function (err, inFile) {
      if (err) return cb(err)
      var tmpPath = path.join(os.tmpdir(), 'cross-zip-' + Date.now())
      fs.mkdir(tmpPath, function (err) {
        if (err) return cb(err)
        fs.writeFile(path.join(tmpPath, path.basename(inPath)), inFile, function (err) {
          if (err) return cb(err)
          inPath = tmpPath
          doZip()
        })
      })
    })
  }
1228705
public function setTempDir($dir)
    {
        $dir = $this->addTrailingSlash($dir);

        if (!is_dir($dir)) {
            $this->log->addDebug(sprintf('Creating new temporary directory "%s"', $dir));

            if (!mkdir($dir, 0755, true)) {
                $this->log->addCritical(sprintf('Could not create temporary directory "%s"', $dir));

                return false;
            }
        }

        $this->tempDir = $dir;

        return true;
    }
450254
def _get_directory_stash(self, path):
        """"""

        try:
            save_dir = AdjacentTempDirectory(path)
            save_dir.create()
        except OSError:
            save_dir = TempDirectory(kind="uninstall")
            save_dir.create()
        self._save_dirs[os.path.normcase(path)] = save_dir

        return save_dir.path
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;
    }
556944
void setTempDir() {
        synchronized (AbstractDatabaseConfiguration.class) {
            final String tempDir = getTempDir();
            if (!tempDir.equals(AbstractDatabaseConfiguration.tempDir)) {
                AbstractDatabaseConfiguration.tempDir = tempDir;
                C4Base.setTempDir(AbstractDatabaseConfiguration.tempDir);
            }
        }
    }
1237819
def _cleanup_tempdir(tempdir):
    """"""
    try:
        shutil.rmtree(tempdir)
    except OSError as err:
        if err.errno != errno.ENOENT:
            raise
1365134
def save(self, cachedir=None, cfgstr=None, verbose=VERBOSE, quiet=QUIET,
             ignore_keys=None):
        
        fpath = self.get_fpath(cachedir, cfgstr=cfgstr)
        if verbose:
            print('[Cachable] cache save: %r' % (basename(fpath),))

        if hasattr(self, '__getstate__'):
            statedict = self.__getstate__()
        else:
            statedict = self.__dict__

        if ignore_keys is None:
            save_dict = statedict
        else:
            save_dict = {key: val
                         for (key, val) in six.iteritems(statedict)
                         if key not in ignore_keys}

        util_io.save_data(fpath, save_dict)
        return fpath
840885
def MakeDir(self, path="temp"):
        
        full_path = _os.path.join(self.path_home, path)

        # only make it if it doesn't exist!
        if not _os.path.exists(full_path): _os.makedirs(full_path)
281607
def _CreateTempDir(prefix, run_dir=None):
  
  temp_dir = tempfile.mkdtemp(prefix=prefix + '-', dir=run_dir)
  try:
    yield temp_dir
  finally:
    shutil.rmtree(temp_dir)
900679
protected void setTempDirectory(Resource tempDirectory, boolean flush) throws ExpressionException {
	if (!isDirectory(tempDirectory) || !tempDirectory.isWriteable()) {
	    SystemOut.printDate(getErrWriter(),
		    "temp directory [" + tempDirectory + "] is not writable or can not be created, using directory [" + SystemUtil.getTempDirectory() + "] instead");
	    tempDirectory = SystemUtil.getTempDirectory();
	    if (!tempDirectory.isWriteable()) {
		SystemOut.printDate(getErrWriter(), "temp directory [" + tempDirectory + "] is not writable");
	    }
	}
	if (flush) ResourceUtil.removeChildrenEL(tempDirectory);// start with a empty temp directory
	this.tempDirectory = tempDirectory;
    }
561646
protected void setTempDirectory(String strTempDirectory, boolean flush) throws ExpressionException {
	setTempDirectory(resources.getResource(strTempDirectory), flush);
    }
1087706
def tempdir(fun):
    '''

    '''
    def wrapper(*args, **kwargs):
        self = args[0]
        if os.path.isdir(self._tempdir):
            shutil.rmtree(self._tempdir)
        self._tempdir = tempfile.mkdtemp()
        # If the method raises an exception, delete the temporary dir
        try:
            retval = fun(*args, **kwargs)
        finally:
            shutil.rmtree(self._tempdir)
        if os.path.isdir(self._tempdir):
            shutil.rmtree(self._tempdir)
        return retval
    return wrapper
771917
def save(self):
        
        task.save_new_environment(self.name, self.datadir, self.target,
            self.ckan_version, self.deploy_target, self.always_prod)
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;
    }