summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibFileSystem/TempFile.h
diff options
context:
space:
mode:
authorCameron Youell <cameronyouell@gmail.com>2023-03-22 02:36:18 +1100
committerLinus Groh <mail@linusgroh.de>2023-03-21 19:03:21 +0000
commit752f06f228119a70c59e844dcd2b9560e757b0ff (patch)
tree639eb770fb4db090adc69bfa77a19655fea4fa77 /Userland/Libraries/LibFileSystem/TempFile.h
parent492e5c3c14e4c15c2a655b876f4c77c1df30bb00 (diff)
downloadserenity-752f06f228119a70c59e844dcd2b9560e757b0ff.zip
LibFileSystem: Move `TempFile` from `LibCore` to `LibFileSystem`
As suggested in commit de18485
Diffstat (limited to 'Userland/Libraries/LibFileSystem/TempFile.h')
-rw-r--r--Userland/Libraries/LibFileSystem/TempFile.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/Userland/Libraries/LibFileSystem/TempFile.h b/Userland/Libraries/LibFileSystem/TempFile.h
new file mode 100644
index 0000000000..038978f916
--- /dev/null
+++ b/Userland/Libraries/LibFileSystem/TempFile.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020-2023, the SerenityOS developers.
+ * Copyright (c) 2023, Cameron Youell <cameronyouell@gmail.com>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Forward.h>
+#include <AK/String.h>
+
+namespace FileSystem {
+
+class TempFile {
+
+public:
+ static ErrorOr<NonnullOwnPtr<TempFile>> create_temp_directory();
+ static ErrorOr<NonnullOwnPtr<TempFile>> create_temp_file();
+
+ ~TempFile();
+
+ String const& path() const { return m_path; }
+
+private:
+ enum class Type {
+ Directory,
+ File
+ };
+
+ TempFile(Type type, String path)
+ : m_type(type)
+ , m_path(move(path))
+ {
+ }
+
+ Type m_type;
+ String m_path;
+};
+
+}