2022-01-07 16:22:39 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020-2021, the SerenityOS developers.
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2022-12-04 18:02:33 +00:00
|
|
|
#include <AK/DeprecatedString.h>
|
2022-01-07 16:22:39 +02:00
|
|
|
#include <AK/Noncopyable.h>
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
|
|
|
|
|
class TempFile {
|
|
|
|
|
AK_MAKE_NONCOPYABLE(TempFile);
|
|
|
|
|
AK_MAKE_NONMOVABLE(TempFile);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
enum class Type {
|
|
|
|
|
File,
|
|
|
|
|
Directory
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static NonnullOwnPtr<TempFile> create(Type = Type::File);
|
|
|
|
|
~TempFile();
|
|
|
|
|
|
2022-12-04 18:02:33 +00:00
|
|
|
DeprecatedString path() const { return m_path; }
|
2022-01-07 16:22:39 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
TempFile(Type);
|
2022-12-04 18:02:33 +00:00
|
|
|
static DeprecatedString create_temp(Type);
|
2022-01-07 16:22:39 +02:00
|
|
|
|
|
|
|
|
Type m_type { Type::File };
|
2022-12-04 18:02:33 +00:00
|
|
|
DeprecatedString m_path;
|
2022-01-07 16:22:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|