summaryrefslogtreecommitdiffstats
path: root/util/folder/tempdir.cpp
diff options
context:
space:
mode:
authoraosipenko <[email protected]>2022-02-10 16:48:08 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:48:08 +0300
commit69e3c43df1c96bc2ac8946bf4dfb1f5fc438ff7f (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13 /util/folder/tempdir.cpp
parent948fd24d47d4b3b7815aaef1686aea00ef3f4288 (diff)
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'util/folder/tempdir.cpp')
-rw-r--r--util/folder/tempdir.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/util/folder/tempdir.cpp b/util/folder/tempdir.cpp
index 760cc03fa1e..6fdf8f753c1 100644
--- a/util/folder/tempdir.cpp
+++ b/util/folder/tempdir.cpp
@@ -1,34 +1,34 @@
-#include "tempdir.h"
+#include "tempdir.h"
-#include "dirut.h"
+#include "dirut.h"
-#include <util/system/fs.h>
-#include <util/system/maxlen.h>
-
-TTempDir::TTempDir()
+#include <util/system/fs.h>
+#include <util/system/maxlen.h>
+
+TTempDir::TTempDir()
: TTempDir(nullptr, TCreationToken{})
{
}
TTempDir::TTempDir(const char* prefix, TCreationToken)
- : TempDir()
+ : TempDir()
, Remove(true)
-{
- char tempDir[MAX_PATH];
+{
+ char tempDir[MAX_PATH];
if (MakeTempDir(tempDir, prefix) != 0) {
ythrow TSystemError() << "Can't create temporary directory";
}
- TempDir = tempDir;
-}
-
+ TempDir = tempDir;
+}
+
TTempDir::TTempDir(const TString& tempDir)
- : TempDir(tempDir)
+ : TempDir(tempDir)
, Remove(true)
-{
+{
NFs::Remove(TempDir);
MakeDirIfNotExist(TempDir.c_str());
-}
-
+}
+
TTempDir TTempDir::NewTempDir(const TString& root) {
return {root.c_str(), TCreationToken{}};
}
@@ -37,8 +37,8 @@ void TTempDir::DoNotRemove() {
Remove = false;
}
-TTempDir::~TTempDir() {
+TTempDir::~TTempDir() {
if (Remove) {
RemoveDirWithContents(TempDir);
}
-}
+}