blob: a2e9f49eb120f5ae84715a8806d0d6767d84a48c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "tempfile.h"
TTempFileHandle::TTempFileHandle()
: TTempFile(MakeTempName())
, TFile(CreateFile())
{
}
TTempFileHandle::TTempFileHandle(const TString& fname)
: TTempFile(fname)
, TFile(CreateFile())
{
}
TTempFileHandle TTempFileHandle::InCurrentDir(const TString& filePrefix, const TString& extension) {
return TTempFileHandle(MakeTempName(".", filePrefix.c_str(), extension.c_str()));
}
TTempFileHandle TTempFileHandle::InDir(const TFsPath& dirPath, const TString& filePrefix, const TString& extension) {
return TTempFileHandle(MakeTempName(dirPath.c_str(), filePrefix.c_str(), extension.c_str()));
}
TFile TTempFileHandle::CreateFile() const {
return TFile(Name(), CreateAlways | RdWr);
}
|