File: tmpfile.d

package info (click to toggle)
sambamba 1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,528 kB
  • sloc: sh: 220; python: 166; ruby: 147; makefile: 103
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;
}