File: tmpfile.d

package info (click to toggle)
sambamba 0.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,632 kB
  • sloc: sh: 206; python: 163; ruby: 147; makefile: 105
file content (20 lines) | stat: -rw-r--r-- 490 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module bio.core.utils.tmpfile;

import std.path;
import std.process;

/// Absolute path of temporary file.
///
/// Params:
///     filename - base name
///     tmpdir   - temporary directory
///                                   
string tmpFile(string filename, string tmpdir=null) {
    if (tmpdir != null) {
        return buildPath(tmpdir, filename);
    }
version(Windows)
    return buildPath(std.process.getenv("TEMP"), filename);
else version(Posix)
    return "/tmp/" ~ filename;
}