Coverage Report

Created: 2026-07-25 07:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibFileSystem/TempFile.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2020-2023, the SerenityOS developers.
3
 * Copyright (c) 2023, Cameron Youell <cameronyouell@gmail.com>
4
 *
5
 * SPDX-License-Identifier: BSD-2-Clause
6
 */
7
8
#pragma once
9
10
#include <AK/Forward.h>
11
#include <AK/String.h>
12
13
namespace FileSystem {
14
15
class TempFile {
16
17
public:
18
    static ErrorOr<NonnullOwnPtr<TempFile>> create_temp_directory();
19
    static ErrorOr<NonnullOwnPtr<TempFile>> create_temp_file();
20
21
    ~TempFile();
22
23
0
    ByteString const& path() const { return m_path; }
24
25
private:
26
    enum class Type {
27
        Directory,
28
        File
29
    };
30
31
    TempFile(Type type, ByteString path)
32
0
        : m_type(type)
33
0
        , m_path(move(path))
34
0
    {
35
0
    }
36
37
    Type m_type;
38
    ByteString m_path;
39
};
40
41
}