mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:07:47 +00:00
LibFileSystem: Move TempFile
from LibCore
to LibFileSystem
As suggested in commit de18485
This commit is contained in:
parent
492e5c3c14
commit
752f06f228
6 changed files with 22 additions and 23 deletions
41
Userland/Libraries/LibFileSystem/TempFile.h
Normal file
41
Userland/Libraries/LibFileSystem/TempFile.h
Normal file
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue