Programming-Idioms

Implementation
D

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Implementation edit is for fixing errors and enhancing with metadata.

Instead of changing the code of the snippet, consider creating another D implementation.

Other implementations
import "io/ioutil"
dir, err := ioutil.TempDir("", "")
require 'tmpdir' 
td = Dir.mktmpdir
sysutils
var
  GUID: TGUID;
  Succes: Boolean;

begin
  CreateGUID(GUID);
  Succes := CreateDir(GetTempDir + GUIDToString(GUID));
end.
import tempfile	
td = tempfile.TemporaryDirectory()
extern crate tempdir;
use tempdir::TempDir;
let tmp = TempDir::new("prefix")?;
function createTempDir(): ?string
{
    $path = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . mt_rand() . microtime(true);
    if (mkdir($path)) {
        return $path;
    }
    return null;
}
import System.IO.Temp
withTempDirectory $ \d -> do
  -- do something with d
use Path::Tiny qw(tempdir);
my $path = tempdir;
using System.IO;
string newDir = Path.GetTempPath() + Guid.NewGuid();
Directory.CreateDirectory(newDir);