blob: 74a64f854d065d478b5fd157577e17427e1acbb3 (
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);
}
|